public function getLegacyValue(Value $value, FieldDefinition $fieldDefinition)
    {
        /** @var CustomFieldHandlerInterface $handler */
        $handler = $this->registry->handle($value);

        if (null === $handler) {

            return new LegacyData(
                $fieldDefinition->id,
                0,
                0,
                (string)$value
            );
        }

        if ($handler instanceof CustomLegacyFieldHandlerInterface) {
            return $handler->getLegacyValue($value, $fieldDefinition);
        }

        return new LegacyData(
            $fieldDefinition->id,
            0,
            0,
            (string) $handler->toString($value, $fieldDefinition)
        );
    }