protected function updateCredentialHash(PasswordableInterface $identityObject, $password)
    {
        $cryptoService = $this->getMapper()->getPasswordService();
        if (!$cryptoService instanceof Bcrypt) {
            return $this;
        }

        $hash = explode('$', $identityObject->getPassword());
        if ($hash[2] === $cryptoService->getCost()) {
            return $this;
        }

        $identityObject->setPassword($cryptoService->create($password));

        return $this;
    }