public Task <Result> SaveAsync(EventBuffer <TId> buffer)
 {
     if (buffers.TryGetValue(buffer.AggregateId, out EventBuffer <TId> existing))
     {
         existing.AddRange(buffer.Uncommitted);
         existing.MarkAllAsCommitted();
         buffer.MarkAllAsCommitted();
     }
     else
     {
         buffers.Add(buffer.AggregateId, buffer.MarkAllAsCommitted());
     }
     return(Task.FromResult(Result.OK));
 }
 public InMemoryEventStore(EventBuffer <TId> initial)
 {
     buffers.Add(initial.AggregateId, initial.MarkAllAsCommitted());
 }