static void CleanAttributes(IEnumerable<IHtmlAttribute> attributes, ICollection<string> allowedAttributes)
{
var attributesToBeRemoved = new List<IHtmlAttribute>();
foreach(var attribute in attributes) {
if(allowedAttributes.Contains(attribute.Name))
CleanAttributeValue(attribute);
else
attributesToBeRemoved.Add(attribute);
}
foreach(var attribute in attributesToBeRemoved)
attribute.Remove();
}