Only run deferred insert handlers on success

If one of the lifecycle handlers was deferred it was possible
for another handler to throw an exception, trigger a rollback,
but still run the deferred handler outside of a transaction.

This patch adjusts so that deferred lifecycle handlers are only
run on successfull commit.

Change-Id: Ib1fce114753a7d0058ec83ea7be8510976e6f537