protected function detachOrPersistNode(AbstractNestedNode $node)
    {
        if (null !== $refreshed = $this->find($node->getUid())) {
            return $this->detachFromTree($refreshed)
                            ->refreshExistingNode($node);
        }

        if (false === $this->_em->contains($node)) {
            $this->_em->persist($node);
        }

        return $this;
    }
protected function detachOrPersistNode(AbstractNestedNode $node)
    {
        if (null !== $refreshed = $this->find($node->getUid())) {
            return $this->detachFromTree($refreshed)
                            ->refreshExistingNode($node);
        }

        if (false === $this->_em->contains($node)) {
            $this->_em->persist($node);
        }

        return $this;
    }
protected function detachOrPersistNode ( AbstractNestedNode $ node ) { if ( null !== $ refreshed = $ this -> find ( $ node -> getUid ( ) ) ) { return $ this -> detachFromTree ( $ refreshed ) -> refreshExistingNode ( $ node ) ; } if ( false === $ this -> _em -> contains ( $ node ) ) { $ this -> _em -> persist ( $ node ) ; } return $ this ; }
Persist a new node or detach it from tree if already exists.

@param  \BackBee\NestedNode\AbstractNestedNode                     $node
@return \BackBee\NestedNode\Repository\NestedNodeRepository
Persist a new node or detach it from tree if already exists .