/// <summary>
        /// Remove NewsletterMailTranslation.
        /// </summary>
        /// <param name="request">The NewsletterMailTranslation Request Pivot to remove.</param>
        public void DeleteNewsletterMailTranslation(NewsletterMailTranslationRequestPivot request)
        {
            if (request?.NewsletterMailTranslationPivot == null)
            {
                throw new ArgumentNullException(nameof(request));
            }
            NewsletterMailTranslation newsletterMailTranslation = _unitOfWork.NewsletterMailTranslationRepository.GetById(request.NewsletterMailTranslationPivot.TranslationId);

            _unitOfWork.NewsletterMailTranslationRepository.Delete(newsletterMailTranslation);
            _unitOfWork.Save();
        }
        /// <summary>
        /// Create new NewsletterMailTranslation.
        /// </summary>
        /// <param name="request">The NewsletterMailTranslation Request Pivot to add.</param>
        /// <returns>NewsletterMailTranslation Response Pivot created.</returns>
        public NewsletterMailTranslationResponsePivot CreateNewsletterMailTranslation(NewsletterMailTranslationRequestPivot request)
        {
            if (request?.NewsletterMailTranslationPivot == null)
            {
                throw new ArgumentNullException(nameof(request));
            }
            NewsletterMailTranslation newsletterMailTranslation = request.NewsletterMailTranslationPivot.ToEntity();

            _unitOfWork.NewsletterMailTranslationRepository.Insert(newsletterMailTranslation);
            _unitOfWork.Save();
            return(new NewsletterMailTranslationResponsePivot
            {
                NewsletterMailTranslationPivot = newsletterMailTranslation.ToPivot()
            });
        }
        /// <summary>
        /// Change NewsletterMailTranslation values.
        /// </summary>
        /// <param name="request">The NewsletterMailTranslation Request Pivot to change.</param>
        public void UpdateNewsletterMailTranslation(NewsletterMailTranslationRequestPivot request)
        {
            if (request?.NewsletterMailTranslationPivot == null)
            {
                throw new ArgumentNullException(nameof(request));
            }

            NewsletterMailTranslation newsletterMailTranslation = _unitOfWork.NewsletterMailTranslationRepository.GetById(request.NewsletterMailTranslationPivot.TranslationId);

            if (request.NewsletterMailTranslationPivot.NewsletterMailSource != null)
            {
                newsletterMailTranslation.NewsletterMailSource = request.NewsletterMailTranslationPivot.NewsletterMailSource;
            }
            newsletterMailTranslation.NewsletterMailSubject = request.NewsletterMailTranslationPivot.NewsletterMailSubject;
            _unitOfWork.Save();
        }
 /// <summary>
 /// From NewsletterMailTranslation To NewsletterMailTranslation Pivot.
 /// </summary>
 /// <param name="newsletterMailTranslation">newsletterMailTranslation TO ASSEMBLE</param>
 /// <returns>NewsletterMailTranslationPivot result.</returns>
 public static NewsletterMailTranslationPivot ToPivot(this NewsletterMailTranslation newsletterMailTranslation)
 {
     if (newsletterMailTranslation == null)
     {
         return(null);
     }
     return(new NewsletterMailTranslationPivot()
     {
         TranslationId = newsletterMailTranslation.TranslationId,
         NewsletterMailSource = newsletterMailTranslation.NewsletterMailSource,
         NewsletterMailSubject = newsletterMailTranslation.NewsletterMailSubject,
         NewsletterMailId = newsletterMailTranslation.NewsletterMailId.Value,
         NewsletterMail = newsletterMailTranslation.NewsletterMail?.ToPivot(),
         LanguageId = newsletterMailTranslation.LanguageId.Value,
         Language = newsletterMailTranslation.Language?.ToPivot(),
     });
 }
        /// <summary>
        /// Change NewsletterMailTranslation values.
        /// </summary>
        /// <param name="request">The NewsletterMailTranslation Request Pivot to change.</param>
        public void UpdateNewsletterMailTranslationRange(NewsletterMailTranslationRequestPivot request)
        {
            if (request?.NewsletterMailTranslationPivotList == null)
            {
                throw new ArgumentNullException(nameof(request));
            }

            foreach (var translation in request.NewsletterMailTranslationPivotList)
            {
                NewsletterMailTranslation newsletterMailTranslation = _unitOfWork.NewsletterMailTranslationRepository.GetById(translation.TranslationId);
                if (translation.NewsletterMailSource != null)
                {
                    newsletterMailTranslation.NewsletterMailSource = translation.NewsletterMailSource;
                }
                newsletterMailTranslation.NewsletterMailSubject = translation.NewsletterMailSubject;
                _unitOfWork.Save();
            }
        }