Deadlock retries

Retry transaction on deadlock error.
Yes, that makes things a bit simpler. Good call. I've added that after verifying it causes no additional DB queries.