public async Task StoreAsync(AggregateBase aggregate) { // Take non-persisted events and write them to the event store var events = aggregate.GetUncommittedEvents().ToArray(); await store.AppendStreamAsync(aggregate.Id, aggregate.Version, events) .ConfigureAwait(false); // Once succesfully persisted, clear events from list of uncommitted events aggregate.ClearUncommittedEvents(); }