/**
  * @param EntryDistribution $entryDistribution
  * @param DistributionProfile $distributionProfile
  * @return BatchJob
  */
 protected static function addSubmitDeleteJob(EntryDistribution $entryDistribution, DistributionProfile $distributionProfile)
 {
     $entryDistribution->setStatus(EntryDistributionStatus::DELETING);
     if (!$entryDistribution->save()) {
         KalturaLog::err("Unable to save entry distribution [" . $entryDistribution->getId() . "] status");
         $entryDistribution->reload();
         return null;
     }
     $entryDistribution->setDirtyStatus(null);
     //Moved down to ensure previous save is done Atomically
     $entryDistribution->save();
     $jobData = new kDistributionDeleteJobData();
     $jobData->setDistributionProfileId($entryDistribution->getDistributionProfileId());
     $jobData->setEntryDistributionId($entryDistribution->getId());
     $jobData->setProviderType($distributionProfile->getProviderType());
     $jobData->setRemoteId($entryDistribution->getRemoteId());
     $jobData->setMediaFiles($entryDistribution->getMediaFiles());
     $batchJob = new BatchJob();
     $batchJob->setEntryId($entryDistribution->getEntryId());
     $batchJob->setPartnerId($entryDistribution->getPartnerId());
     $batchJob->setObjectId($entryDistribution->getId());
     $batchJob->setObjectType(kPluginableEnumsManager::apiToCore('BatchJobObjectType', ContentDistributionBatchJobObjectType::ENTRY_DISTRIBUTION));
     $jobType = ContentDistributionPlugin::getBatchJobTypeCoreValue(ContentDistributionBatchJobType::DISTRIBUTION_DELETE);
     $jobSubType = $distributionProfile->getProviderType();
     return kJobsManager::addJob($batchJob, $jobData, $jobType, $jobSubType);
 }