Better exception handling.
Make sure identity_insert is off when exception is thrown.