private Dictionary <string, object> GetDictionary <T>(StateInfoCollection <T> coll)
        {
            var dictionary = new Dictionary <string, object>();

            foreach (string key in coll.Keys)
            {
                dictionary[key] = coll[key];
            }
            return(dictionary);
        }
		object IConfigurationSectionHandler.Create(Object parent, Object configContext, XmlNode section)
		{
			StateInfoCollection<Dialog> dialogs = new StateInfoCollection<Dialog>();
			Dialog dialog;
			int dialogIndex = 0;

			XmlNode dialogNode;
			int i;
			string dialogInitial;
#if NET40Plus
			string resourceType, resourceKey;
#endif
			for (i = 0; i < section.ChildNodes.Count; i++)
			{
				dialog = new Dialog();

				dialogNode = section.ChildNodes[i];
				if (dialogNode.NodeType != XmlNodeType.Comment)
				{
					if (dialogNode.Attributes["initial"] == null || dialogNode.Attributes["initial"].Value.Length == 0)
						throw new ConfigurationErrorsException(string.Format(CultureInfo.CurrentCulture, Resources.DialogAttributeMissing, "initial"));
					dialogInitial = dialogNode.Attributes["initial"].Value;
					dialog.Index = dialogIndex;
					dialogIndex++;
					if (dialogNode.Attributes["key"] == null || dialogNode.Attributes["key"].Value.Length == 0)
						throw new ConfigurationErrorsException(string.Format(CultureInfo.CurrentCulture, Resources.DialogAttributeMissing, "key"));
					dialog.Key = dialogNode.Attributes["key"].Value;
					dialog.Title = dialogNode.Attributes["title"] != null ? dialogNode.Attributes["title"].Value : string.Empty;
#if NET40Plus
					resourceType = dialogNode.Attributes["resourceType"] != null ? dialogNode.Attributes["resourceType"].Value : "StateInfo";
					resourceKey = dialogNode.Attributes["resourceKey"] != null ? dialogNode.Attributes["resourceKey"].Value : string.Empty;
					if (resourceKey.Length != 0)
						dialog.TitleFunc = () => (string)HttpContext.GetGlobalResourceObject(resourceType, resourceKey, Thread.CurrentThread.CurrentUICulture);
#else
					dialog.ResourceType = dialogNode.Attributes["resourceType"] != null ? dialogNode.Attributes["resourceType"].Value : "StateInfo";
					dialog.ResourceKey = dialogNode.Attributes["resourceKey"] != null ? dialogNode.Attributes["resourceKey"].Value : string.Empty;
#endif
					dialog.Attributes = new StateInfoCollection<string>();
					foreach (XmlAttribute attribute in dialogNode.Attributes)
						dialog.Attributes[attribute.Name] = attribute.Value;
					if (dialogs[dialogNode.Attributes["key"].Value] != null)
						throw new ConfigurationErrorsException(string.Format(CultureInfo.CurrentCulture, Resources.DuplicateDialogKey, dialogNode.Attributes["key"].Value));
					dialogs.Add(dialogNode.Attributes["key"].Value, dialog);

					ProcessStates(dialog, dialogNode);
					ProcessTransitions(dialog, dialogNode);
					dialog.Initial = dialog.States[dialogInitial];
					if (dialog.Initial == null)
						throw new ConfigurationErrorsException(string.Format(CultureInfo.CurrentCulture, Resources.InvalidDialogInitialKey, dialog.Key, dialogInitial));
				}
			}
			return dialogs;
		}