public function hookIsValid(Dictionary $params)
    {
        // Validate nonce
        $form = $params['form'];
        $request = $params['request'];
        $arguments = $params['arguments'];

        $result = Nonce::validateNonce($form->getName(), $request->session, $arguments);
        $nonce_name = Nonce::getParameterName();
        if ($result === null)
        {
            $params['errors'] = [$nonce_name => [[
                'msg' => 'Nonce was not submitted for form {form}',
                'context' => ['form' => $form->getName()]
            ]]];
            $params['valid'] = false;
        }
        elseif ($result === false)
        {
            $params['errors'] = [$nonce_name => [[
                'msg' => 'Nonce was invalid for form {form}',
                'context' => ['form' => $form->getName()] 
            ]]];
            $params['valid'] = false;
        }
    }