coding #126 moving the logic from the controller to the service