public async Task UpdateChapterEmail(Guid currentMemberId, Guid chapterId, EmailType type, UpdateEmail chapterEmail) { await AssertMemberIsChapterAdmin(currentMemberId, chapterId); ChapterEmail existing = await _emailRepository.GetChapterEmail(chapterId, type); if (existing == null) { existing = new ChapterEmail(Guid.Empty, chapterId, type, chapterEmail.Subject, chapterEmail.HtmlContent); } else { existing.HtmlContent = chapterEmail.HtmlContent; existing.Subject = chapterEmail.Subject; } ValidateChapterEmail(existing); if (existing.Id != Guid.Empty) { await _emailRepository.UpdateChapterEmail(existing); } else { await _emailRepository.AddChapterEmail(existing); } }