Move business logic out of controller