public function generate()
    {
        try {

            if (!$this->isEnabled()) {
                throw new CaptchaDriverException(
                    'Captcha driver has not been configured.'
                );
            }

            $oResponse = $this->oDriver->generate();

            if (!($oResponse instanceof CaptchaForm)) {
                throw new CaptchaDriverException(
                    'Driver must return an instance of \Nails\Captcha\Factory\CaptchaForm.'
                );
            }

        } catch (\Exception $e) {
            $oResponse = Factory::factory('CaptchaForm', 'nails/module-captcha');
            $oResponse->setHtml(
                '<p style="color: red; padding: 1rem; border: 1px solid red;">ERROR: ' . $e->getMessage() . '</p>'
            );
        }

        return $oResponse;
    }