public void Save(IAggregateRoot aggregate) { List <IEvent> aggregateEvents; if (!aggregateEventDictionary.TryGetValue(aggregate.GetId(), out aggregateEvents)) { aggregateEvents = new List <IEvent>(); aggregateEventDictionary.Add(aggregate.GetId(), aggregateEvents); } foreach (var @event in aggregate.GetUncommitedChanges()) { aggregateEvents.Add(@event); this.eventPublisher.Publish(@event); } aggregate.MarkChangesAsCommited(); }