/**
  * @param BatchJob $dbBatchJob
  * @param kDistributionUpdateJobData $data
  * @param BatchJob $twinJob
  * @return BatchJob
  */
 public static function onDistributionDisableJobUpdated(BatchJob $dbBatchJob, kDistributionUpdateJobData $data, BatchJob $twinJob = null)
 {
     if ($data->getResults() || $data->getSentData()) {
         $entryDistribution = EntryDistributionPeer::retrieveByPK($data->getEntryDistributionId());
         if (!$entryDistribution) {
             KalturaLog::err("Entry distribution [" . $data->getEntryDistributionId() . "] not found");
             return $dbBatchJob;
         }
         if ($data->getResults()) {
             $entryDistribution->incrementUpdateResultsVersion();
         }
         if ($data->getSentData()) {
             $entryDistribution->incrementUpdateDataVersion();
         }
         $entryDistribution->save();
         if ($data->getResults()) {
             $key = $entryDistribution->getSyncKey(EntryDistribution::FILE_SYNC_ENTRY_DISTRIBUTION_UPDATE_RESULTS);
             kFileSyncUtils::file_put_contents($key, $data->getResults());
             $data->setResults(null);
         }
         if ($data->getSentData()) {
             $key = $entryDistribution->getSyncKey(EntryDistribution::FILE_SYNC_ENTRY_DISTRIBUTION_UPDATE_DATA);
             kFileSyncUtils::file_put_contents($key, $data->getSentData());
             $data->setSentData(null);
         }
         $dbBatchJob->setData($data);
         $dbBatchJob->save();
     }
     switch ($dbBatchJob->getStatus()) {
         case BatchJob::BATCHJOB_STATUS_PENDING:
             return self::onDistributionDisableJobPending($dbBatchJob, $data, $twinJob);
         case BatchJob::BATCHJOB_STATUS_FINISHED:
             return self::onDistributionDisableJobFinished($dbBatchJob, $data, $twinJob);
         case BatchJob::BATCHJOB_STATUS_FAILED:
         case BatchJob::BATCHJOB_STATUS_FATAL:
             return self::onDistributionDisableJobFailed($dbBatchJob, $data, $twinJob);
         default:
             return $dbBatchJob;
     }
 }