Moved query from controller to model repository
part 4 done