Refactoring orm process