/// <summary>
    /// Converts the <see cref="CommittedAggregateEvents" /> to <see cref="Contracts.CommittedAggregateEvents" />s.
    /// </summary>
    /// <param name="committedAggregateEvents">The committed events.</param>
    /// <returns>The converted <see cref="Contracts.CommittedAggregateEvents" />.</returns>
    public static Contracts.CommittedAggregateEvents ToProtobuf(this CommittedAggregateEvents committedAggregateEvents)
    {
        var aggregateRootVersion = committedAggregateEvents.AsEnumerable().LastOrDefault()?.AggregateRootVersion ?? 0;
        var protobuf             = new Contracts.CommittedAggregateEvents
        {
            AggregateRootId      = committedAggregateEvents.AggregateRoot.ToProtobuf(),
            EventSourceId        = committedAggregateEvents.EventSource.Value,
            AggregateRootVersion = aggregateRootVersion
        };

        protobuf.Events.AddRange(committedAggregateEvents.Select(_ => _.ToProtobuf()));
        return(protobuf);
    }
 /// <inheritdoc/>
 public Task <Partial <EmbeddingCurrentState> > TryProject(EmbeddingCurrentState currentState, CommittedAggregateEvents events, ExecutionContext executionContext, CancellationToken cancellationToken)
 => TryProject(
     currentState,
     new UncommittedEvents(events.Select(_ => new UncommittedEvent(_.EventSource, _.Type, _.Public, _.Content)).ToList()),
     executionContext,
     cancellationToken);