Refactor to move data query from controller to model