/**
     * checks for duplicate records from same IP
     *
     * @param Pap_Contexts_Click $context
     * @return string
     */
    private function checkMultipleClicksFromSameIP(Pap_Contexts_Click $context) {
        if(Gpf_Settings::get(Pap_Settings::REPEATING_CLICKS_SETTING_NAME) != Gpf::YES) {
            $context->debug('    Check for duplicate clicks with the same IP is not turned on');
            return true;
        }

        $context->debug('    Checking duplicate clicks from the same IP started');

        $checkPeriod = Gpf_Settings::get(Pap_Settings::REPEATING_CLICKS_SECONDS_SETTING_NAME);
        $checkAction = Gpf_Settings::get(Pap_Settings::REPEATING_CLICKS_ACTION_SETTING_NAME);
        if($checkPeriod == '' || $checkPeriod == '0' || !is_numeric($checkPeriod)) {
            $context->debug("Checking period is not correct: '$checkPeriod'");
            return true;
        }
        if($checkAction != self::ACTION_DECLINE && $checkAction != self::ACTION_DONTSAVE) {
            $context->debug("Action after check is not correct: '$checkAction'");
            return true;
        }

        $ip = $context->getVisit()->getIp();
        $clickObject = new Pap_Db_RawClick();

        //only clicks on same banner will be fraudulent
        $bannerId = false;
        if (Gpf_Settings::get(Pap_Settings::REPEATING_BANNER_CLICKS) == Gpf::YES) {
            $bannerId = $context->getBannerId();
            if (!strlen($bannerId)) {
                $bannerId = false;
            }
        }

        $recordsCount = $clickObject->getNumberOfClicksFromSameIP($ip, $checkPeriod, $bannerId, $context->getVisitDateTime());
        if($recordsCount > 0) {
            if($checkAction == self::ACTION_DONTSAVE) {
                $context->debug("    STOPPING (setting setDoTrackerSave(false), found another clicks from the same IP: $ip within $checkPeriod seconds");
                $context->setDoTrackerSave(false);
                $context->debug('      Checking duplicate clicks from the same IP endeded');
                return false;

            } else {
                $context->debug("  DECLINING, found another clicks from the same IP: $ip within $checkPeriod seconds");

                $this->declineClick($context);

                $context->debug('      Checking duplicate clicks from the same IP endeded');
                return true;
            }
        } else {
            $context->debug("    No duplicate clicks from the same IP: $ip found");
        }

        $context->debug('      Checking duplicate clicks from the same IP endeded');
        return true;
    }
 /**
  * @return Pap_Db_RawClick
  * @throws Gpf_Exception
  */
 public function getClick() {
     $click = new Pap_Db_RawClick();
     $click->setId($this->getClickId());
     $click->load();
     return $click;
 }
	protected function saveRawClick(Pap_Db_RawClick $rawClick) {
		Gpf_Log::debug('Calling save on raw click');
		$rawClick->save();
		Gpf_Log::debug('Saving done');
	}