public void MaxSelectedOptionsRuleCheck( ConfigurationItem configurationItem, MaxSelectedOptionsRule rule, out string error) { error = string.Empty; var selectedCount = configurationItem.ConfigurationItemOptions.Count(o => o.IsSelected); if (selectedCount > rule.Count) { error = $"{configurationItem.Name} requires at least {rule.Count} option(s)"; } }