/**
  * Remove Track from Multimedia Object
  */
 public function removeTrackFromMultimediaObject(MultimediaObject $multimediaObject, $trackId)
 {
     $track = $multimediaObject->getTrackById($trackId);
     $trackPath = $track->getPath();
     $trackProfile = str_replace('profile:', '', preg_grep('/^profile:*/', $track->getTags())[0]);
     $isNotOpencast = !$track->containsTag('opencast');
     $multimediaObject->removeTrackById($trackId);
     $this->dm->persist($multimediaObject);
     $this->dm->flush();
     $relatedJob = $this->jobRepo->findOneBy(array('path_end' => $trackPath, 'mm_id' => $multimediaObject->getId()));
     if ($relatedJob) {
         $this->jobService->deleteJob($relatedJob->getId());
     }
     if ($this->forceDeleteOnDisk && $trackPath && $isNotOpencast) {
         $this->deleteFileOnDisk($trackPath);
     }
     return $multimediaObject;
 }