public AvatarData(AvatarAppearance appearance)
        {
            AvatarType = 1; // SL avatars
            Data       = new Dictionary <string, string>();

            Data["Serial"] = appearance.Serial.ToString();
            // Wearables
            Data["AvatarHeight"] = appearance.AvatarHeight.ToString();

            if (appearance.Texture != null)
            {
                Data["Textures"] = OSDParser.SerializeJsonString(appearance.Texture.GetOSD());
            }

            for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++)
            {
                for (int j = 0; j < appearance.Wearables[i].Count; j++)
                {
                    string fieldName = String.Format("Wearable {0}:{1}", i, j);
                    Data[fieldName] = String.Format("{0}:{1}",
                                                    appearance.Wearables[i][j].ItemID.ToString(),
                                                    appearance.Wearables[i][j].AssetID.ToString());
                }
            }

            // Visual Params
            string[] vps    = new string[AvatarAppearance.VISUALPARAM_COUNT];
            byte[]   binary = appearance.VisualParams;

            for (int i = 0; i < AvatarAppearance.VISUALPARAM_COUNT; i++)
            {
                vps[i] = binary[i].ToString();
            }

            Data["VisualParams"] = String.Join(",", vps);

            // Attachments
            var attachments = appearance.GetAttachmentsDictionary();

            foreach (KeyValuePair <int, List <AvatarAttachment> > kvp in attachments)
            {
                for (int i = 0; i < kvp.Value.Count; i++)
                {
                    var attach = kvp.Value[i];
                    Data["_ap_" + attach.AttachPoint + "_" + i]  = attach.ItemID.ToString();
                    Data["_apa_" + attach.AttachPoint + "_" + i] = attach.AssetID.ToString();
                }
            }
        }