Add transaction management to destroy function.