public function setPassword(User $user, $password)
    {
        $encoder = $this->container->get('security.encoder_factory')
            ->getEncoder($user);

        $salt = $this->createSalt();

        $encryptedPassword = $encoder->encodePassword($password, $salt);

        $user
            ->setPassword($encryptedPassword)
            ->setSalt($salt);
    }