private function mergeRootQueues($root, $candidates)
{
if (!is_array($candidates)) {
$candidates = array($candidates);
}
foreach ($candidates as $c) {
$seen = false;
foreach ($root as $r) {
if ($r->id == $c->id) {
$seen = true;
break;
}
}
if (!$seen) {
$root[] = $c;
}
}
return $root;
}