public static IEnumerable <IPublishedContent> FilterSelection(IEnumerable <IPublishedContent> source, string author, string category, string month, string year) { var filterByCategory = !string.IsNullOrWhiteSpace(category); var filterByAuthor = !string.IsNullOrWhiteSpace(author); if (filterByAuthor && filterByCategory) { var postsInCategory = DataHelpers.FilterByPrevalueName(source, "category", category); var postsByAuthor = DataHelpers.FilterByPrevalueName(source, "author", author); source = postsInCategory.Intersect(postsByAuthor).ToList(); } else { if (filterByAuthor) { source = DataHelpers.FilterByPrevalueName(source, "author", author); } if (filterByCategory) { source = DataHelpers.FilterByPrevalueName(source, "category", category); } } if (!string.IsNullOrWhiteSpace(year)) { source = DataHelpers.FilterByYearAndMonth(source, month, year, "releaseDate"); } return(source); }