public void CommitChanges(Guid commitId) { if (commits.Contains(commitId)) { throw new DuplicateCommitException(); } persistenceEngine.Commit(streamId.BucketId, streamId.Id, commitId, currentSequence, UncommittedEvents, UncommittedHeaders); if (!UncommittedHeaders.ContainsKey(PreventCommitDispatchHeader.Key)) { UncommittedEvents.ForEach(e => eventDispatcher.Dispatch(e.Body)); } PopulateStream(); }