private function buildXML(array $params = [])
    {
        $xml = new \SimpleXMLElement('<?xml version="1.0"?><issue></issue>');

        foreach ($params as $k => $v) {
            if ('custom_fields' === $k && is_array($v)) {
                $this->attachCustomFieldXML($xml, $v);
            } elseif ('watcher_user_ids' === $k && is_array($v)) {
                $watcherUserIds = $xml->addChild('watcher_user_ids', '');
                $watcherUserIds->addAttribute('type', 'array');
                foreach ($v as $watcher) {
                    $watcherUserIds->addChild('watcher_user_id', (int) $watcher);
                }
            } elseif ('uploads' === $k && is_array($v)) {
                $uploadsItem = $xml->addChild('uploads', '');
                $uploadsItem->addAttribute('type', 'array');
                foreach ($v as $upload) {
                    $upload_item = $uploadsItem->addChild('upload', '');
                    foreach ($upload as $upload_k => $upload_v) {
                        $upload_item->addChild($upload_k, $upload_v);
                    }
                }
            } else {
                // "addChild" does not escape text for XML value, but the setter does.
                // http://stackoverflow.com/a/555039/99904
                $xml->$k = $v;
            }
        }

        return $xml;
    }