transaction should be began and commit/rollback when appropriate