moving the services functionality out of controller and into service