public static function toBlock(Serializer $serializer, $json)
    {
        if (empty($json)) {
            return null;
        }

        $contentArray = json_decode($json, true);
        if (!array_key_exists("type", $contentArray)) {
            return null;
        }

        $className = BlockFactory::getBlockClass($contentArray["type"]);
        if (!class_exists($className)) {
            return null;
        }

        return $serializer->deserialize($json, $className, 'json');
    }