private void Add(SubExpression subExpression) { // Find an existing subfilter to OR with SubExpression candidate = this.SubExpressions.FirstOrDefault((s) => subExpression.CanOr(s)); // If can or, replace the existing one with the OR of the two if (candidate != null) { this.SubExpressions.Remove(candidate); this.SubExpressions.Add(subExpression.Or(candidate)); } else { // Can't OR, add the new one to the list this.SubExpressions.Add(subExpression); } }