private static Location Resetfilters(string fh_location, bool includeSearchTerm, int publicationId) { Location location = new Location(fh_location); Criterion criterion = location.getCriterion("publicationid"); Criterion criterion2 = location.getCriterion("schematitle"); Criterion criterion3 = location.getCriterion(string.Format("{0}_product_groups", publicationId)); SearchCriterion criterion4 = location.getSearchCriterion(); location.removeAllCriteria(); if (criterion != null) { location.addCriterion(criterion); } if (criterion2 != null) { location.addCriterion(criterion2); } if (criterion3 != null) { location.addCriterion(criterion3); } if (includeSearchTerm && (criterion4 != null)) { location.addCriterion(criterion4); } return location; }