moved search method from view to Model