public function unlock($document)
{
if ($this->getDocumentState($document) != self::STATE_MANAGED) {
throw new \InvalidArgumentException("Document is not MANAGED.");
}
$documentName = get_class($document);
$this->getDocumentPersister($documentName)->unlock($document);
}