private function makeArrayField($fieldname, $arrayData, $postFields) {
        foreach ($arrayData as $key => $value) {
            $key = urlencode($key);
            if (is_object($value)) {
                $value = (array)$value;
            }
            if (is_array($value)) { //the value is an array, call the function recursively
                $newfieldname = $fieldname . "[$key]";
                $postFields = $this->makeArrayField($newfieldname, $value, $postFields);
            } else {
                $postFields[] = $fieldname . "[$key]=" . urlencode($value);
            }
        }
        return $postFields;
    }