public void SaveSettings(ModuleInfo moduleContext, T settings)
        {
            Requires.NotNull("settings", settings);
            Requires.NotNull("ctlModule", moduleContext);

            this.Mapping.ForEach(mapping =>
            {
                var attribute = mapping.Attribute;
                var property  = mapping.Property;

                if (property.CanRead) // Should be, because we asked for properties with a Get accessor.
                {
                    var settingValueAsString = SerializationController.SerializeProperty(settings, property, attribute.Serializer);

                    if (attribute is ModuleSettingAttribute)
                    {
                        this._moduleController.UpdateModuleSetting(moduleContext.ModuleID, mapping.FullParameterName, settingValueAsString);
                        moduleContext.ModuleSettings[mapping.FullParameterName] = settingValueAsString; // temporary fix for issue 3692
                    }
                    else if (attribute is TabModuleSettingAttribute)
                    {
                        this._moduleController.UpdateTabModuleSetting(moduleContext.TabModuleID, mapping.FullParameterName, settingValueAsString);
                        moduleContext.TabModuleSettings[mapping.FullParameterName] = settingValueAsString; // temporary fix for issue 3692
                    }
                    else if (attribute is PortalSettingAttribute)
                    {
                        PortalController.UpdatePortalSetting(moduleContext.PortalID, mapping.FullParameterName, settingValueAsString);
                    }
                }
            });
            DataCache.SetCache(this.CacheKey(moduleContext.TabModuleID), settings);
        }
        private void SaveSettings(int portalId, ModuleInfo moduleContext, T settings)
        {
            this.Mapping.ForEach(mapping =>
            {
                var attribute = mapping.Attribute;
                var property  = mapping.Property;

                if (property.CanRead) // Should be, because we asked for properties with a Get accessor.
                {
                    var settingValueAsString = SerializationController.SerializeProperty(settings, property, attribute.Serializer);

                    if (attribute is ModuleSettingAttribute && moduleContext != null)
                    {
                        this.moduleController.UpdateModuleSetting(moduleContext.ModuleID, mapping.FullParameterName, settingValueAsString);
                        moduleContext.ModuleSettings[mapping.FullParameterName] = settingValueAsString; // temporary fix for issue 3692
                    }
                    else if (attribute is TabModuleSettingAttribute && moduleContext != null)
                    {
                        this.moduleController.UpdateTabModuleSetting(moduleContext.TabModuleID, mapping.FullParameterName, settingValueAsString);
                        moduleContext.TabModuleSettings[mapping.FullParameterName] = settingValueAsString; // temporary fix for issue 3692
                    }
                    else if (attribute is PortalSettingAttribute && portalId != -1)
                    {
                        PortalController.UpdatePortalSetting(portalId, mapping.FullParameterName, settingValueAsString);
                    }
                    else if (attribute is HostSettingAttribute)
                    {
                        HostController.Instance.Update(mapping.FullParameterName, settingValueAsString);
                    }
                }
            });
            DataCache.SetCache(this.CacheKey(moduleContext == null ? portalId : moduleContext.TabModuleID), settings);
        }
 /// <summary>
 /// Deserializes the property.
 /// </summary>
 /// <param name="settings">The settings.</param>
 /// <param name="property">The property.</param>
 /// <param name="propertyValue">The property value.</param>
 /// <exception cref="System.InvalidCastException"></exception>
 private void DeserializeProperty(T settings, PropertyInfo property, ParameterAttributeBase attribute, string propertyValue)
 {
     SerializationController.DeserializeProperty(settings, property, propertyValue, attribute.Serializer);
 }