/**
  *
  * @param Password $password
  * @return \Cloud\LdapBundle\Entity\Service
  */
 public function addPassword(Password $password)
 {
     // reject password if no plaintext password is set and incompatible hash
     if ($password->getPasswordPlain() === null && $password->getEncoder() !== $this->getEncoder()) {
         throw new \InvalidArgumentException();
     }
     if (isset($this->passwords[$password->getId()])) {
         $this->removePassword($this->passwords[$password->getId()]);
     }
     $this->passwords[$password->getId()] = $password;
     $this->getAttributes()->get('userpassword')->add($password->getAttribute());
     if ($password->getService() !== $this) {
         $password->setService($this);
     }
     return $this;
 }