public static function createMetaDataXml(
        string $id,
        string $parent = "-1",
        array $extra = [],
        string $service = null
    ): string {
        if ($service !== null) {
            $extra["desc"] = [
                "_attributes"   =>  [
                    "id"        =>  "cdudn",
                    "nameSpace" =>  "urn:schemas-rinconnetworks-com:metadata-1-0/",
                ],
                "_value"        =>  "SA_RINCON{$service}_X_#Svc{$service}-0-Token",
            ];
        }

        $xml = XmlWriter::createXml([
            "DIDL-Lite" =>  [
                "_attributes"   =>  [
                    "xmlns:dc"      =>  "http://purl.org/dc/elements/1.1/",
                    "xmlns:upnp"    =>  "urn:schemas-upnp-org:metadata-1-0/upnp/",
                    "xmlns:r"       =>  "urn:schemas-rinconnetworks-com:metadata-1-0/",
                    "xmlns"         =>  "urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/",
                ],
                "item"  =>  array_merge([
                    "_attributes"   =>  [
                        "id"            =>  $id,
                        "parentID"      =>  $parent,
                        "restricted"    =>  "true",
                    ],
                ], $extra),
            ],
        ]);

        # Get rid of the xml header as only the DIDL-Lite element is required
        $metadata = explode("\n", $xml)[1];

        return $metadata;
    }