Moving the data to service and injecting in controller