public async Task <bool> Handle(SaveApiSecretCommand request, CancellationToken cancellationToken) { if (!request.IsValid()) { NotifyValidationErrors(request); return(false); } var savedApi = await _apiResourceRepository.GetByName(request.ResourceName); if (savedApi == null) { await Bus.RaiseEvent(new DomainNotification("Api", "Api not found")); return(false); } var secret = request.ToEntity(savedApi); _apiSecretRepository.Add(secret); if (await Commit()) { await Bus.RaiseEvent(new ApiSecretSavedEvent(request.Id, request.ResourceName)); return(true); } return(false); }