Add proper upsert behavior
Add proper upsert behavior

CC: @chreekat

This implements the upsert behaviour as described in
https://github.com/yesodweb/persistent/issues/613

It specifically fixes the bug outlined here:
https://github.com/yesodweb/persistent/issues/613#issuecomment-251748721

gbwey/persistent,yesodweb/persistent,gbwey/persistent,naushadh/persistent,creichert/persistent,paul-rouse/persistent,erikd/persistent,plow-technologies/persistent,bitemyapp/persistent,psibi/persistent,gbwey/persistent