refactoring to a service model