$ownerKuserId = $partner->getAccountOwnerKuserId();
        if (is_null($ownerKuserId)) {
            KalturaLog::log('Skipping [' . $partner->getId() . '] because owner kuser id = null');
            file_put_contents($lastPartnerFile, $lastPartner);
            continue;
        }
        $partner->setAccountOwnerKuserId($ownerKuserId);
        if (!$dryRun) {
            KalturaLog::log('SAVED - partner [' . $partner->getId() . '] owner kuser id [' . $ownerKuserId . ']');
            $partner->save();
        } else {
            KalturaLog::log('DRY RUN only - partner [' . $partner->getId() . '] owner kuser id [' . $ownerKuserId . ']');
        }
        file_put_contents($lastPartnerFile, $lastPartner);
    }
    $partners = getPartners($lastPartner, $partnerLimitEachLoop);
}
$msg = 'Done - ' . ($dryRun ? 'DRY RUN!' : 'REAL RUN!');
KalturaLog::log($msg);
echo $msg;
function getPartners($lastPartner, $partnerLimitEachLoop)
{
    PartnerPeer::clearInstancePool();
    $c = new Criteria();
    $c->add(PartnerPeer::ID, $lastPartner, Criteria::GREATER_THAN);
    $c->add(PartnerPeer::ADMIN_EMAIL, null, Criteria::EQUAL);
    $c->add(PartnerPeer::ADMIN_NAME, null, Criteria::EQUAL);
    $c->addAscendingOrderByColumn(PartnerPeer::ID);
    $c->setLimit($partnerLimitEachLoop);
    PartnerPeer::setUseCriteriaFilter(false);
    $partners = PartnerPeer::doSelect($c);
        $add = true;
        foreach ($excludeCts as $exclude) {
            if (strcmp($current, $exclude) === 0) {
                $add = false;
                break;
            }
        }
        if ($add) {
            $serviceConfigFiles[] = $current;
        }
    }
}
foreach ($serviceConfigFiles as $file) {
    // init service config for current file
    resetServiceConfig();
    $partners = getPartners($file);
    if (!$partners || count($partners) == 0) {
        $msg = '***** NOTICE - No partners found for config file [' . $file . ']';
        KalturaLog::notice($msg);
        echo $msg . PHP_EOL;
        continue;
    }
    $serviceConfig = new KalturaServiceConfig($file, null, false, false);
    $servicesTable = $serviceConfig->getAllServicesByCt();
    // for each defined service.action
    foreach ($servicesTable as $ctPath => $services) {
        foreach ($services as $serviceActionName) {
            // get permission item object for the current service/action
            $serviceConfig->setServiceName($serviceActionName);
            $serviceSplit = explode('.', $serviceActionName);
            $serviceName = $serviceSplit[0];