extract controller functions to service