coding #126 moving the logic to a service