public ActionResult GetImagesByLabels(int storeId, String[] labels, String entityType, int id) { var images = FileManagerRepository.GetFilesByStoreIdAndLabels(storeId, labels); var list = new List <FileManager>(); if (entityType.Equals(StoreConstants.ProductType, StringComparison.InvariantCultureIgnoreCase)) { var productFiles = ProductFileRepository.GetProductFilesByProductId(id); list.AddRange(images.Where(r => !productFiles.Select(r1 => r1.FileManagerId).Contains(r.Id))); } else if (entityType.Equals(StoreConstants.BlogsType, StringComparison.InvariantCultureIgnoreCase) || entityType.Equals(StoreConstants.NewsType, StringComparison.InvariantCultureIgnoreCase)) { var contentFiles = ContentFileRepository.GetContentFilesByContentId(id); list.AddRange(images.Where(r => !contentFiles.Select(r1 => r1.FileManagerId).Contains(r.Id))); } return(Json(list, JsonRequestBehavior.AllowGet)); }