public function rewriteIds($idMapping)
{
// reset existing elements store
$this->elements = [];
foreach ($this->elementIds as &$elementId) {
$type = $elementId["type"];
$id = $elementId["id"];
if (array_key_exists($type, $idMapping) and array_key_exists((int) $id, $idMapping[$type])) {
$elementId["id"] = $idMapping[$type][$id];
}
}
$this->setElements();
}