Refactoring inventory transaction