public async Task <EmailTemplate> CreateEmailTemplate(EmailTemplate emailTemplate)
        {
            if (emailTemplate == null)
            {
                throw new ArgumentNullException(nameof(emailTemplate));
            }

            if (HasPermission(Permission.ManageBulkEmails))
            {
                var userId = GetActiveUserId();
                emailTemplate.BodyHtml    = emailTemplate.BodyHtml.Trim();
                emailTemplate.BodyText    = emailTemplate.BodyText.Trim();
                emailTemplate.CreatedAt   = _dateTimeProvider.Now;
                emailTemplate.CreatedBy   = GetActiveUserId();
                emailTemplate.Description = emailTemplate.Description.Trim();
                emailTemplate.EmailsSent  = 0;
                emailTemplate.FromAddress = emailTemplate.FromAddress.Trim();
                emailTemplate.FromName    = emailTemplate.FromName.Trim();
                emailTemplate.SiteId      = GetCurrentSiteId();
                emailTemplate.Subject     = emailTemplate.Subject.Trim();
                return(await _emailTemplateRepository.AddSaveAsync(userId, emailTemplate));
            }
            else
            {
                _logger.LogError("User {UserId} doesn't have permission to create an email template.",
                                 GetClaimId(ClaimType.UserId));
                throw new GraException("Permission denied.");
            }
        }