protected function flatResponse(
        Request $request,
        $filter,
        $filterFieldDescriptors,
        $fieldDescriptors,
        $entityName
    ) {
        $listBuilder = $this->getListBuilder($entityName, $fieldDescriptors);

        foreach ($filter as $key => $value) {
            if (is_array($value)) {
                $listBuilder->in($filterFieldDescriptors[$key], $value);
            } else {
                $listBuilder->where($filterFieldDescriptors[$key], $value);
            }
        }

        $ids = null;
        if (null !== $request->get('ids')) {
            $ids = array_filter(explode(',', $request->get('ids', '')));
            $listBuilder->in($fieldDescriptors['id'], $ids);
            $listBuilder->limit(count($ids));
        }

        // Only add group by id if categories are processed.
        $fieldsParam = $request->get('fields');
        $fields = explode(',', $fieldsParam);
        if (isset($filter['categories']) ||
            !$fieldsParam ||
            array_search('categories', $fields) !== false
        ) {
            $listBuilder->addGroupBy($fieldDescriptors['id']);
        }

        // Do not show product variants in list.
        $listBuilder->where(
            $filterFieldDescriptors['type_id'],
            $this->getProductTypesMap()['PRODUCT_VARIANT'],
            DoctrineListBuilder::WHERE_COMPARATOR_UNEQUAL
        );

        if (json_decode($request->get('disablePagination'))) {
            return [
                '_embedded' => [
                    'products' => $listBuilder->execute(),
                ],
            ];
        }

        $list = new ListRepresentation(
            $listBuilder->execute(),
            self::$entityKey,
            'get_products',
            $request->query->all(),
            $listBuilder->getCurrentPage(),
            $listBuilder->getLimit(),
            $listBuilder->count()
        );

        return $list;
    }