Refactored "business logic"into a service class from the controller