public function starToggle($id)
 {
     if (!is_numeric($id)) {
         throw new Exceptions\InvalidArgumentException("Argument \$id must be type of numeric, '{$id}' given ");
     }
     try {
         $entry = $this->mailboxDao->find($id);
         $star = $entry->getStarred();
         $entry->setStarred(!$star);
         $this->entityManager->flush();
     } catch (\Exception $ex) {
         $this->logError($ex->getMessage());
         throw new Exceptions\DataErrorException($ex->getMessage(), $ex->getCode(), $ex->getPrevious());
     }
 }
 public function updateTax(MotivationTax $t)
 {
     try {
         $db = $this->taxDao->find($t->getId());
         if ($db !== null) {
             $db->fromArray($t->toArray());
             $db->setUpdated(new DateTime());
             $this->taxEditorTypeHandle($db);
             $this->taxSeasonTypeHandle($db);
             $this->taxSportGroupTypeHandle($db);
             $this->entityManager->merge($db);
             $this->entityManager->flush();
             $this->invalidateEntityCache($db);
             $this->onUpdate($db);
         }
     } catch (DuplicateEntryException $ex) {
         $this->logWarning($ex->getMessage());
         throw new Exceptions\DuplicateEntryException($ex->getMessage(), $ex->getCode(), $ex->getPrevious());
     } catch (\Exception $ex) {
         $this->logError($ex->getMessage());
         throw new Exceptions\DataErrorException($ex->getMessage(), $ex->getCode(), $ex->getPrevious());
     }
 }