/**
  * Do a MongoDB operation and handle error conversion and creation of
  * the database on the fly.
  *
  * @param \Closure $MongoDBOperation
  * @return mixed
  */
 protected function doOperation(\Closure $MongoDBOperation)
 {
     try {
         return $MongoDBOperation($this->client);
     } catch (\TYPO3\MongoDB\Client\ClientException $clientException) {
         $information = $clientException->getInformation();
         if (isset($information['error']) && $information['error'] === 'not_found' && $information['reason'] === 'no_db_file') {
             if ($this->client->createDatabase($this->databaseName)) {
                 return $this->doOperation($MongoDBOperation);
             } else {
                 throw new \TYPO3\FLOW3\Persistence\Exception('Could not create database ' . $this->database, 1286901880);
             }
         } else {
             throw $clientException;
         }
     }
 }