I can't believe the government prioritized a fucking deserter over James Foley.
Firstly, he probably wasn't a deserter. Secondly, the conditions were entirely unsimilar. Foley was a kidnapped civilian. Bowe Bergdahl was a Prisoner of War.
Negotiated prisoner of war swaps are a long-standing and boringly traditional approach to the inevitable prisoners taken in conflict. Almost every war in history has involved prisoner swaps - including, by the way, deserters. This new principle about prisoner swaps created by the Republican Party is a scam, which you apparently swallowed without question. The US Marine Corps, for instance, vowes never to leave a man behind. Silly lies from the Republican party shouldn't be enough to stop them. You do what you have to to get your man back, even if it means idiots like yourself or corrupt propagandists in the other party accuse you of being a traitor or whatever.
Now, some people have suggested that this creates an incentive for the Taliban to take American soldiers prisoner. Indeed it does. This is very much a good thing. Surely everyone would prefer a live captive than a dead corpse? In any case, it is not easy to take US soldiers prisoner.