public async Task <ICommandResult <TReply> > DeleteAsync(TReply reply) { // Validate if (reply == null) { throw new ArgumentNullException(nameof(reply)); } var result = new CommandResult <TReply>(); // Raise Deleting event Deleting?.Invoke(this, new EntityReplyEventArgs <TReply>(null, reply)); // Invoke EntityReplyDeleting subscriptions foreach (var handler in _broker.Pub <TReply>(this, "EntityReplyDeleting")) { reply = await handler.Invoke(new Message <TReply>(reply, this)); } var success = await _entityReplyStore.DeleteAsync(reply); if (success) { // Raise Deleted event Deleted?.Invoke(this, new EntityReplyEventArgs <TReply>(null, reply)); // Invoke EntityReplyDeleted subscriptions foreach (var handler in _broker.Pub <TReply>(this, "EntityReplyDeleted")) { reply = await handler.Invoke(new Message <TReply>(reply, this)); } return(result.Success(reply)); } return(result.Failed(new CommandError("An unknown error occurred whilst attempting to delete the reply."))); }