Separating the data fetching from controller to factory