public function clear(?string $documentClass = null): void
    {
        if (null === $documentClass) {
            $this->identityMap =
            $this->objects =
            $this->documentStates =
            $this->documentPersisters =
            $this->documentDeletions =
            $this->documentUpdates =
            $this->documentChangeSets =
            $this->readOnlyObjects =
            $this->originalDocumentData = [];
        } else {
            throw new \Exception('Not implemented yet.');
        }

        if ($this->evm->hasListeners(Events::onClear)) {
            $this->evm->dispatchEvent(Events::onClear, new Events\OnClearEventArgs($this->manager, $documentClass));
        }
    }