private function fromDocument(UserInterface $user, Document $document)
 {
     if (!$user instanceof User) {
         throw new \InvalidArgumentException('Invalid user object');
     }
     $user->fromArray($document->getAll());
     $user->setId($document->getId());
     return $user;
 }