private async Task PerformCoordinatedReconcileAsync( Reference aggregate, IEnumerable <DomainEvent> events, IAggregateReconciliationProxy proxy, CancellationToken?cancellationToken) { EventCentricAggregateRoot?existing = await proxy .GetAsync(aggregate, cancellationToken : cancellationToken) .ConfigureAwait(false); if (existing is null) { existing = await factory .CreateAsync(aggregate, cancellationToken : cancellationToken) .ConfigureAwait(false); } else if (ignorePreviousVersions) { events = RemovePreviousVersions(events, existing.Version); } await ApplyAsync( existing, events, proxy, aggregate, cancellationToken : cancellationToken) .ConfigureAwait(false); }