public async Task CreateEmailTemplateAsync(EmailTemplate emailTemplate)
 {
     try
     {
         _emailTemplateRepository.Create(emailTemplate);
         await _uow.SaveChangesAsync();
     }
     catch (Exception e)
     {
         throw e;
     }
 }
        public ActionResult Update(EmailTemplate vm)
        {
            ApiResult <EmailTemplate> apiResult;

            if (ModelState.IsValid)
            {
                if (vm.Id > 0)
                {
                    apiResult = TryExecute(() =>
                    {
                        var emailTemplate             = _emailTemplateRepository.Get(vm.Id);
                        emailTemplate.Name            = vm.Name;
                        emailTemplate.Content         = vm.Content;
                        emailTemplate.UpdatedByUserId = WebUser.Id;
                        _emailTemplateRepository.Update(emailTemplate);
                        _unitOfWork.Commit();
                        return(vm);
                    }, "Email Template updated sucessfully");
                }
                else
                {
                    apiResult = TryExecute(() =>
                    {
                        vm.CreatedByUserId = WebUser.Id;
                        _emailTemplateRepository.Create(vm);
                        _unitOfWork.Commit();
                        return(vm);
                    }, "Email Template created sucessfully");
                }
            }
            else
            {
                apiResult = ApiResultFromModelErrors <EmailTemplate>();
            }

            return(Json(apiResult, JsonRequestBehavior.AllowGet));
        }