public override void Save()
{
// Checking for duplicated options
var doc = new XmlDocument();
try
{
doc.LoadXml(this.ContentListDefinition);
}
catch
{
return;
}
var data = XDocument.Parse(ContentListDefinition);
var values = new List<string>();
var nodes = data.Nodes();
var descandants = from descendant in data.Descendants() where descendant.Name.LocalName == "Option" select descendant;
foreach (var descandant in descandants)
{
if (values.Contains(descandant.Attribute("value").Value))
{
throw new InvalidOperationException("There are multiple values for answers.");
}
values.Add(descandant.Attribute("value").Value);
}
base.Save();
}
}