private async Task SaveAndDispatchEvents(AggregateRoot root)
{
// Here should be the logic to persist this commit to some kind of store.
// We use a stateless actor, so that means that this actor will be broken when it is pulled out of memory
var commit = root.Commit();
// We push these events to the servicebus.
var eventBusService = ServiceProxy.Create<IEventBusService>(new Uri("fabric:/CQRSMicroservices.ServiceFabric.Application/EventBusService"));
await Task.WhenAll(commit.Events.ToList().Select(async e => await eventBusService.Dispatch(e.ToJson())));
}
}