/**
  * Remove Material from Multimedia Object
  */
 public function removeMaterialFromMultimediaObject(MultimediaObject $multimediaObject, $materialId)
 {
     $material = $multimediaObject->getMaterialById($materialId);
     $materialPath = $material->getPath();
     $multimediaObject->removeMaterialById($materialId);
     $this->dm->persist($multimediaObject);
     $this->dm->flush();
     if ($this->forceDeleteOnDisk && $materialPath) {
         $this->deleteFileOnDisk($materialPath);
     }
     return $multimediaObject;
 }