/// <summary>
        /// Updates the settings store identified by the key <paramref name="key"/> using
        /// data from the specified parameter.
        /// </summary>
        /// <typeparam name="T">Type of the <paramref name="data"/> parameter.</typeparam>
        /// <param name="storeKey">The store key.</param>
        /// <param name="data">The data.</param>
        /// <remarks>
        /// The store's underlying xml file is saved when calling this method. This means
        /// the method will fail if the store is not associated with a file.
        /// </remarks>
        public void UpdateSettingsStore <T>(string storeKey, T data) where T : class
        {
            if (!Stores.ContainsKey(storeKey))
            {
                throw new ArgumentException(string.Format(
                                                "Settings store {0} doesn't exist", storeKey), "storeKey");
            }
            if (string.IsNullOrEmpty(Stores[storeKey].FileName))
            {
                throw new ApplicationException(string.Format(
                                                   "Can't update settings store {0}: it is not associated with a file. You should rather use SaveSettingsStore.", storeKey));
            }

            if (data == null)
            {
                return;
            }

            // First update our internal dictionary
            serializer.UpdateDictionary(Stores[storeKey].Settings, data);

            // Then save back the dictionary to the xml document and file.
            var store = Stores[storeKey];

            if (store.Document == null)
            {
                store.Document = new XmlDocument();
            }
            serializer.Serialize(store.Settings, store.Document);
            store.Document.Save(store.FileName);
        }