/**
  * Save an image with FAL
  * @param \TYPO3\CMS\Core\Resource\File $fileObject
  * @param \MUM\BjrFreizeit\Domain\Model\Leisure $leisure
  * @param $pid
  * @return int last insert id, file reference uid
  *
  */
 public function saveImage(\TYPO3\CMS\Core\Resource\File $fileObject, \MUM\BjrFreizeit\Domain\Model\Leisure $leisure)
 {
     //$dateiname = $filename; // Dateinamen auslesen
     $tabellenName = 'tx_bjrfreizeit_domain_model_leisure';
     $feldName = 'image';
     $data = array('uid_local' => $fileObject->getUid(), 'uid_foreign' => $leisure->getUid(), 'tablenames' => $tabellenName, 'fieldname' => $feldName, 'pid' => $leisure->getPid(), 'table_local' => 'sys_file', 'tstamp' => time(), 'crdate' => time(), 'cruser_id' => 100);
     $where = 'deleted ="0" AND hidden ="0" AND tablenames ="' . $tabellenName . '" AND uid_foreign=' . (int) $leisure->getUid() . ' AND table_local="sys_file"' . ' AND fieldname ="' . $feldName . '"';
     $row = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('*', 'sys_file_reference', $where);
     if (empty($row)) {
         $GLOBALS['TYPO3_DB']->exec_INSERTquery('sys_file_reference', $data, FALSE);
         $res = $GLOBALS['TYPO3_DB']->sql_insert_id();
     } else {
         $data = array('uid_local' => $fileObject->getUid(), 'tstamp' => time(), 'cruser_id' => 100);
         $res = $GLOBALS['TYPO3_DB']->exec_UPDATEquery('sys_file_reference', $where, $data, FALSE);
     }
     return $res;
 }