public void CreateViewDataObject(int activeStoreScopeConfiguration, string rootSettingClass = null)
 {
     _viewData[ViewDataKey] = new StoreDependingSettingData()
     {
         ActiveStoreScopeConfiguration = activeStoreScopeConfiguration,
         RootSettingClass = rootSettingClass
     };
 }
        public void GetOverrideKeys(object settings, object model, int storeId, ISettingService settingService, bool isRootModel = true, ILocalizedModelLocal localized = null, int?index = null)
        {
            if (storeId <= 0)
            {
                return;         // single store mode -> there are no overrides
            }
            var data = Data;

            if (data == null)
            {
                data = new StoreDependingSettingData();
            }

            var settingName            = settings.GetType().Name;
            var properties             = settings.GetType().GetProperties();
            var localizedEntityService = EngineContext.Current.Resolve <ILocalizedEntityService>();

            var modelType = model.GetType();

            foreach (var prop in properties)
            {
                var name          = prop.Name;
                var modelProperty = modelType.GetProperty(name);

                if (modelProperty == null)
                {
                    continue;   // setting is not configurable or missing or whatever... however we don't need the override info
                }
                var key     = String.Empty;
                var setting = String.Empty;

                if (localized == null)
                {
                    key     = settingName + "." + name;
                    setting = settingService.GetSettingByKey <string>(key, storeId: storeId);
                }
                else
                {
                    key     = "Locales[" + index.ToString() + "]." + name;
                    setting = localizedEntityService.GetLocalizedValue(localized.LanguageId, 0, settingName, name);
                }

                if (!String.IsNullOrEmpty(setting))
                {
                    data.OverrideSettingKeys.Add(key);
                }
            }

            if (isRootModel)
            {
                data.ActiveStoreScopeConfiguration = storeId;
                data.RootSettingClass = settingName;

                _viewData[ViewDataKey] = data;
            }
        }