private void CreateOrChangeContentLang(SiteContainer context, Content instance, Content cache, Language lang) { ContentLang contenttLang = null; if (cache != null) { contenttLang = context.ContentLang.FirstOrDefault(p => p.ContentId == cache.Id && p.LanguageId == lang.Id); } if (contenttLang == null) { var newPostLang = new ContentLang { ContentId = instance.Id, LanguageId = lang.Id, Title = instance.Title, Text = HttpUtility.HtmlDecode(instance.Text), SeoDescription = instance.SeoDescription, SeoKeywords = instance.SeoKeywords }; context.AddToContentLang(newPostLang); } else { contenttLang.Title = instance.Title; contenttLang.Text = HttpUtility.HtmlDecode(instance.Text); contenttLang.SeoDescription = instance.SeoDescription; contenttLang.SeoKeywords = instance.SeoKeywords; } context.SaveChanges(); }