/**
  * @param Metasource|int $metasource
  * @return int
  */
 public function deleteMetasource($metasource)
 {
     if (!$metasource instanceof Metasource) {
         $metasource = $this->findMetasource($metasource);
     }
     return $this->metasourcesRepository->delete($metasource);
 }
 /**
  * Funkce pro smazání metasource
  * @param Metasource $metasource
  * @return int
  * @throws \LeanMapper\Exception\InvalidStateException
  */
 public function deleteMetasource(Metasource $metasource)
 {
     $preprocessing = $this->preprocessingFactory->getPreprocessingInstance($metasource->getPpConnection(), $metasource->user);
     $ppDataset = new PpDataset($metasource->ppDatasetId, $metasource->name, null, $metasource->type, $metasource->size);
     $preprocessing->deletePpDataset($ppDataset);
     return $this->metasourcesRepository->delete($metasource);
 }