 
     }
 
+    private static function encodeDictionary(xml:XML, dict:Dictionary, context:AMFXContext):void
+    {
+        var ref:int = context.findObject(dict);
+        var element:XML;
+        if (ref >= 0)
+        {
+            element = <ref />;
+            element.@["id"] = String(ref);
+        }
+        else
+        {
+            rememberObject(context, dict);
+
+            element = <dictionary />;
+
+            var classInfo:Object = ObjectUtil.getClassInfo(dict, null, CLASS_INFO_OPTIONS);
+            var properties:Array = classInfo.properties;
+            var count:uint = properties.length;
+
+            for (var i:uint = 0; i < count; i++)
+            {
+                var prop:Object = properties[i];
+                encodeValue(element, prop, context);
+                encodeValue(element, dict[prop], context);
+            }
+        }
+        element.@["length"] = String(count);
+        xml.appendChild(element);
+    }
+
+    private static function rememberObject(context:AMFXContext, obj:*):void
+    {
+        context.addObject(obj);
+    }
+
     private static function encodeObject(xml:XML, obj:*, context:AMFXContext):void
     {
         var ref:int = context.findObject(obj);

        }
        else
        {
            //Remember date object
            context.addObject(date);

            element = <date />;
            element.appendChild(new XML(date.getTime().toString()));

        }
        else
        {
            rememberObject(context, obj);

            element = <object />;

