private void Merge(DataModel.Introduction dbItem, IEnumerable <ExternalUrl> newExternalUrls)
        {
            if (newExternalUrls == null)
            {
                newExternalUrls = new List <ExternalUrl>();
            }

            var toRemove = dbItem.ExternalUrls.Where(eu => !newExternalUrls.Any(x => eu.ExternalUrlId == x.Id)).ToList();

            foreach (var item in toRemove)
            {
                dbItem.ExternalUrls.Remove(item);

                _context.ExternalUrls.Remove(item.ExternalUrl);
                _context.IntroductionExternalUrls.Remove(item);
            }

            var toAdd = newExternalUrls.Where(x => x.Id == null);

            foreach (var item in toAdd)
            {
                dbItem.ExternalUrls.Add(AbstractionsConverter.ToIntroductionExternalUrl(item));
            }

            var toUpdate = newExternalUrls.Where(x => x.Id.HasValue);

            foreach (var item in toUpdate)
            {
                var upd = dbItem.ExternalUrls.FirstOrDefault(x => x.ExternalUrlId == item.Id.Value);

                upd.ExternalUrl.DisplayName = item.DisplayName;
                upd.ExternalUrl.Url         = item.Url;
                upd.ExternalUrl.Version++;
            }
        }
        private static void CheckBeforeUpdate(DataModel.Introduction dbItem, Introduction introduction)
        {
            if (dbItem.Version != introduction.Version)
            {
                throw new InconsistencyException
                      (
                          string.Format(Resources.TextMessages.ItemWasAlreadyChanged, introduction.GetType().Name)
                      );
            }

            foreach (var item in dbItem.ExternalUrls)
            {
                var updated = introduction.ExternalUrls?.FirstOrDefault(x => x.Id == item.ExternalUrlId);

                if (updated == null)
                {
                    continue;
                }

                if (item.ExternalUrl.Version != updated.Version)
                {
                    throw new InconsistencyException
                          (
                              string.Format(Resources.TextMessages.ItemWasAlreadyChanged, updated.GetType().Name)
                          );
                }
            }
        }
        private void Merge(DataModel.Introduction dbItem, Introduction newItem)
        {
            dbItem.Title             = newItem.Title;
            dbItem.Content           = newItem.Content;
            dbItem.PosterDescription = newItem.PosterDescription;
            dbItem.PosterUrl         = newItem.PosterUrl;
            dbItem.Version++;


            Merge(dbItem, newItem.ExternalUrls);
        }