protected function registerEvent($payload, $metadata = null)
    {
        if ($payload instanceof AbstractDomainEvent && null === $payload->aggregateId) {
            $payload->setAggregateId($this->getId());
        }

        return $this->getEventContainer()
            ->addEvent($payload, $metadata);
    }