public function registerAggregateRoot(EventSourcedAggregateRoot $aggregateRoot): void
    {
        if ($this->aggregateRoot !== null && $this->aggregateRoot !== $aggregateRoot) {
            throw new DomainException('Aggregate root already registered');
        }

        $this->aggregateRoot = $aggregateRoot;
    }