Implementing undo for nested transactions