add new file to services and moved logic from controllers