Transaction management and more robust error handling. This should get
rid of the DatabaseErrors being thrown on live.
Forgot a rollback on an integrity error.
Added better error messages.