private IEmailTemplate GetEmailTemplate(string templateName, LanguageEnum language) { var templates = _emailTemplateRepository.GetTemplates(templateName); if (templates == null) { throw new TemplateNotFoundException($"No template with name {templateName} found!"); } var template = templates.FirstOrDefault(x => x.LanguageEnum == language); if (template == null) { throw new TemplateNotFoundException($"No template with name {templateName} for language {language} found!"); } return(template); }