private bool IsAttributeValid(string attributeName, string value) { if (AllowedAttributes != null) { // No attributes are allowed if (!AllowedAttributes.Any()) { return(false); } if (!AllowedAttributes.Contains(attributeName)) { return(false); } } if (RequiredAttributes != null) { if (value == null && RequiredAttributes.Contains(attributeName)) { // Don't delete any required attributes return(false); } } if (AllowedValues != null) { if (AllowedValues.TryGetValue(attributeName, out var allowed) && !allowed.Contains(value.Trim())) { return(false); } } if (DisallowedValues != null) { if (DisallowedValues.TryGetValue(attributeName, out var disallowed) && disallowed.Contains(value.Trim())) { return(false); } } return(true); }