protected function getAndOrFilter(IFilter $filter, $operation)
    {
        if (!$operation['children']) {
            return;
        }

        if ($operation['operation'] == 'AND') {
            $filterRule = new ConditionAnd();
        } else {
            $filterRule = new ConditionOr();
        }
        $filter->addFilterRule($filterRule);

        $children = $this->optimizedFilter($filterRule, $operation['children'], $operation['operation']);

        foreach ($children as $child) {
            $subFilter = $this->getMetaModel()->getEmptyFilter();
            $filterRule->addChild($subFilter);
            $this->calculateSubfilter($child, $subFilter);
        }
    }