private static function encodeDictionary($dictionary, &$serialized)
    {
        if (empty($dictionary)) {
            $serialized .= "de";
            return;
        }

        $serialized .= "d";
        foreach(self::sortDictionary($dictionary) as $key => $value) {
            self::encodeString($key, $serialized);
            self::decideEncode($value, $serialized);
        }
        $serialized .= "e";
    }