/// <summary> /// Adds translations and its dependencies /// </summary> public void AddTranslations(IEnumerable <ApplicationTranslation> translations) { if (translations != default(IEnumerable <ApplicationTranslation>)) { translations = translations .Where(t => t.ApplicationId.ToLower() == Id.ToLower()) .ToList(); var appTranslationType = translations.FirstOrDefault(tt => tt.TranslationType.ParameterName == CommonTranslationParameter.TRANS_TP_EXC_APPL.ToString()); //Set translation for App name if (appTranslationType != default(ApplicationTranslation)) { var appName = translations .FirstOrDefault(t => t.Key == Id && t.TranslationTypeId == appTranslationType.TranslationTypeId); if (appName != default(ApplicationTranslation)) { NameOrDescription = appName.NameOrDescription; } } //Set profiles, services and groups translations Profiles.AsParallel().ForAll(pro => { if (pro != null) { pro.AddTranslations(translations); } }); } }