/**
  * Merges the state of a detached document into the persistence context
  * of this DocumentManager and returns the managed copy of the document.
  * The document passed to merge will not become associated/managed with this DocumentManager.
  *
  * @param object $document The detached document to merge into the persistence context.
  * @return object The managed copy of the document.
  */
 public function merge($document)
 {
     if (!is_object($document)) {
         throw new \InvalidArgumentException(gettype($document));
     }
     return $this->_unitOfWork->merge($document);
 }