public function remove($entity)
    {
        try{
            return $this->entityManager->remove($entity);
        } catch(ORMException $e) {
            if (!$this->entityManager->isOpen()) {
                $this->resetEntityManager();
            }
            throw $e;
        }
    }