public async Task Handle(AddAlertConnectionPersonGroupCommand notification) { var alert = await _alertRepository.GetByIdAsync(notification.IdAlerts); if (alert == null) { NotifyErrorValidations("AddAlertConnectionPersonGroupCommand", "Alert not found"); return; } var personGroup = await _personRepository.GetPersonGroupByIdAsync(notification.IdPersonGroups); if (personGroup == null) { NotifyErrorValidations("AddAlertConnectionPersonGroupCommand", "PersonGroup not found"); return; } await _alertRepository.AddConnectionPersonGroupAsync(notification.IdPersonGroups, notification.IdAlerts); if (Commit()) { await _mediator.PublishEvent(new AlertConnectionPersonGroupAddedEvent(_logger, notification.IdPersonGroups, notification.IdAlerts)); } }