moved methods from search controller to model