/**
  * {@inheritdoc}
  * @param object|array $entity
  * @return EntityManager
  */
 public function flush($entity = null)
 {
     try {
         parent::flush($entity);
     } catch (\Exception $e) {
         if ($this->panel) {
             $this->panel->markExceptionOwner($this, $e);
         }
         throw $e;
     }
     return $this;
 }