public async Task SeedAsync() { var templates = await _emailTemplateRepository.GetAllAsync(); if (templates.HasValue && templates.Value.Any()) { return; } var seedTemplates = new List <EmailTemplate>(); seedTemplates.AddRange(GetResetPasswordTemplates()); seedTemplates.AddRange(GetActivateAccountTemplates()); seedTemplates.AddRange(GetRemarkCreatedTemplates()); seedTemplates.AddRange(GetRemarkStateChangedTemplates()); seedTemplates.AddRange(GetPhotosAddedToRemarkTemplates()); seedTemplates.AddRange(GetCommentAddedToRemarkTemplates()); var tasks = seedTemplates.Select(x => _emailTemplateRepository.AddAsync(x)); await Task.WhenAll(tasks); }