move logic out of services controller