Move user query from controller to user model