public async Task <Provider> Add(Provider provider) { var dulicateEmail = (await _repository.Get(x => x.Email.Trim().Equals(provider.Email.Trim()))).Any(); if (dulicateEmail) { _notification.Add("Email already used"); return(null); } using var transaction = await _repository.BeginTransaction(); await _repository.Add(provider); await SendWelcomeEmail(provider); if (provider.Documents.Any()) { await UploadDocuments(provider); } await transaction.CommitAsync(); return(provider); }