refactoring inventory service