public function extractSelected($idsToBeExtractedArray = [])
    {
        //created selected index
        $arrayParameters['selected'] = $idsToBeExtractedArray;

        // Sending service start event
        $arrayParameters = $this->sendEvent('melis_core_gdpr_user_extract_event', $arrayParameters);

        $xml = '';

        if (isset($arrayParameters['results']) && count($arrayParameters['results']) > 0) {
            // Generate and structure the xml
            $xmlDoc = new \DOMDocument('1.0', 'UTF-8');
            $xmlDoc->formatOutput = true;
            $root = $xmlDoc->appendChild($xmlDoc->createElement("xml"));

            $doc = new \DOMDocument();
            $doc->formatOutput = true;

            foreach ($arrayParameters['results'] as $key => $value) {
                $doc->loadXML($value);

                //remove root element xml so that we won't have multiple xml elements on the final output
                $module = $doc->documentElement->getElementsByTagName('*')->item(0);
                $doc->replaceChild($module, $doc->documentElement);

                $xml = $doc->saveXML($doc->documentElement);

                //append each modules xml to one final xml
                $fragment = $xmlDoc->createDocumentFragment();
                $fragment->appendXML($xml);
                $xmlDoc->documentElement->appendChild($fragment);
            }

            $xml = $xmlDoc->saveXML();
        }

        // Sending service end event
        //$arrayParameters = $this->sendEvent('melis_core_gdpr_user_extract_event_end', $xml);
        return $xml;
    }