refactoring business logic out of controllers