protected function generateReferral()
    {
        Factory::helper('string');
        $oDb       = Factory::service('Database');
        $sReferral = '';

        while (1 > 0) {

            $sReferral = random_string('alnum', 8);
            $oQuery    = $oDb->get_where($this->table, ['referral' => $sReferral]);

            if ($oQuery->num_rows() == 0) {
                break;
            }
        }

        return $sReferral;
    }