public function process($collection, $type, $websiteId)
    {
        $this->ruleType = $type;
        $emailRules = $this->getActiveRuleForWebsite($type, $websiteId);

        //if no rule or condition then return the collection untouched
        if (empty($emailRules)) {
            return $collection;
        }
        $condition = $this->serializer->unserialize($emailRules->getConditions());
        if (empty($condition)) {
            return $collection;
        }

        //process rule on collection according to combination
        $combination = $emailRules->getCombination();
        //join tables to collection according to type
        $collection = $this->rulesResource->joinTablesOnCollectionByType($collection, $type);

        if ($combination == self::COMBINATION_TYPE_ALL) {
            $collection = $this->processAndCombination($collection, $condition);
        }

        if ($combination == self::COMBINATION_TYPE_ANY) {
            $collection = $this->processOrCombination($collection, $condition);
        }

        return $collection;
    }