public IList <PointModel> GetFromSearch(SearchModel searchModel) { using (AppTourEntities data = new AppTourEntities()) { Guid searchProfileId = searchModel.SearchProfile != null ? searchModel.SearchProfile.Id : Guid.Empty; ObjectResult <Guid?> pointIds = data.Search(searchProfileId, searchModel.Terms, searchModel.Coordenate); if (pointIds != null) { ConcurrentBag <PointModel> points = new ConcurrentBag <PointModel>(); pointIds.AsParallel().ForAll(x => { points.Add(GetPointForSearch(x.Value)); }); return(points.ToList()); } return(null); } }