public IQueryable <Hardware> GetAllHardwareIQuery(string searchString) { IQueryable <Hardware> hardwares = repository.GetAllHardwareIQuery(); if (!string.IsNullOrEmpty(searchString)) { //Installed nuget package: NinjaNye.SearchExtensions (http://ninjanye.github.io/SearchExtensions/stringsearch.html) which works really good! hardwares = hardwares.Search(h => h.Name ?? "", h => h.Status != null ? h.Status.Name : "", h => h.ProductType != null ? h.ProductType.Name : "", h => h.Description ?? "", h => h.SpecificationFileName ?? "") .Containing(searchString); } return(hardwares); }