public function serialize()
    {
        $unitOfWork       = $this->getManager()->getUnitOfWork();
        $simpleReferences = [];

        foreach ($this->getReferences() as $name => $reference) {
            $className = $this->getRealClass(get_class($reference));

            $simpleReferences[$name] = [$className, $this->getIdentifier($reference, $unitOfWork)];
        }

        $serializedData = json_encode([
            'references' => $simpleReferences,
            'identities' => $this->getIdentities(),
        ]);

        return $serializedData;
    }