public void AddProtection(EditRestrictions er)
{
// Call remove protection before adding a new protection element.
RemoveProtection();
if (er == EditRestrictions.none)
return;
XElement documentProtection = new XElement(XName.Get("documentProtection", w.NamespaceName));
documentProtection.Add(new XAttribute(XName.Get("edit", w.NamespaceName), er.ToString()));
documentProtection.Add(new XAttribute(XName.Get("enforcement", w.NamespaceName), "1"));
settings.Root.AddFirst(documentProtection);
}