public function rewriteIdsService($data, $idMapping)
{
if (is_array($data)) {
foreach ($data as &$element) {
$id = $element->getId();
$type = Element\Service::getElementType($element);
if (array_key_exists($type, $idMapping) && array_key_exists($id, $idMapping[$type])) {
$element = Element\Service::getElementById($type, $idMapping[$type][$id]);
}
}
}
return $data;
}