/**
     * @param Pap_Db_VisitorAffiliate
     * @return Pap_Db_VisitorAffiliate
     */
    public function recognizeAffiliate(Pap_Db_VisitorAffiliate $visitorAffiliate) {
        $user = $this->getUserById($visitorAffiliate->getUserId());

        if ($user == null) {
            $this->isValid = false;
            return;
        }
        
        $this->context->setUserObject($user);

        $campaign = $this->getCampaignById($visitorAffiliate->getCampaignId());
        if ($campaign != null && $this->context->getCampaignObject() == null) {
            $this->context->setCampaignObject($campaign);
        }

        $banner = $this->getBannerById($visitorAffiliate->getBannerId());
        if ($banner != null && $this->context->getBannerObject() == null) {
            $this->context->setBannerObject($banner);
        }

        $channel = $this->getChannelById($visitorAffiliate->getChannelId());
        if ($channel != null) {
            $this->context->setChannelObject($channel);
        }
        $this->context->setVisitorAffiliate($visitorAffiliate);

        $this->isValid = true;
    }
 private function isSameVisitorAffiliates(Pap_Db_VisitorAffiliate $saleVisitorAffiliate, Pap_Db_VisitorAffiliate $clickVisitorAffilaite) {
     return ($saleVisitorAffiliate->getUserId() == $clickVisitorAffilaite->getUserId() &&
     $saleVisitorAffiliate->getCampaignId() == $clickVisitorAffilaite->getCampaignId() &&
     $saleVisitorAffiliate->getChannelId() == $clickVisitorAffilaite->getChannelId());
 }