/// <summary> /// Prepare language model /// </summary> /// <param name="model">Language model</param> /// <param name="language">Language</param> /// <param name="excludeProperties">Whether to exclude populating of some properties of model</param> /// <returns>Language model</returns> public virtual LanguageModel PrepareLanguageModel(LanguageModel model, Language language, bool excludeProperties = false) { if (language != null) { //fill in model values from the entity model ??= language.ToModel <LanguageModel>(); //prepare nested search model PrepareLocaleResourceSearchModel(model.LocaleResourceSearchModel, language); } //set default values for the new model if (language == null) { model.DisplayOrder = _languageService.GetAllLanguages().Max(l => l.DisplayOrder) + 1; model.Published = true; } //prepare available currencies _baseAdminModelFactory.PrepareCurrencies(model.AvailableCurrencies, defaultItemText: _localizationService.GetResource("Admin.Common.EmptyItemText")); //prepare available stores _storeMappingSupportedModelFactory.PrepareModelStores(model, language, excludeProperties); return(model); }