/**
  * Adds a new user
  *
  * @param $user User Entity
  * @return string user id
  */
 public function addUser(User $user)
 {
     $newUser = array('name' => $user->getName(), 'email' => $user->getEmail(), 'password' => $user->getHashPassword());
     $userDocument = new Document($user->getId(), $newUser);
     $response = $this->type->addDocument($userDocument)->getData();
     $this->type->getIndex()->refresh();
     return $response['_id'];
 }