public IEditableDictionary<string> CreateNewEditableStringDictionary(string parent, string attribute, string key, string item, bool useTransaction) { if (useTransaction) { WorldModel.UndoLogger.StartTransaction(string.Format("Set '{0}' {1} to '{2}'", parent, attribute, item)); } Element element = (parent == null) ? null : m_worldModel.Elements.Get(parent); QuestDictionary<string> newDictionary = new QuestDictionary<string>(); if (key != null) { newDictionary.Add(key, item); } if (element != null) { element.Fields.Set(attribute, newDictionary); // setting an element field will clone the value, so we want to return the new dictionary newDictionary = element.Fields.GetAsType<QuestDictionary<string>>(attribute); } EditableDictionary<string> newValue = new EditableDictionary<string>(this, newDictionary); if (useTransaction) { WorldModel.UndoLogger.EndTransaction(); } return newValue; }