private void SetValueInternal(XElement sectionElement, string key, string value)
{
if (String.IsNullOrEmpty(key))
{
throw new ArgumentException(CommonResources.Argument_Cannot_Be_Null_Or_Empty, "key");
}
if (value == null)
{
throw new ArgumentNullException("value");
}
var element = FindElementByKey(sectionElement, key);
if (element != null)
{
element.SetAttributeValue("value", value);
Save();
}
else
{
sectionElement.Add(new XElement("add",
new XAttribute("key", key),
new XAttribute("value", value)));
}
}