protected function getFiltersAsArray()
    {
        $filters = $this->getSession('filters');

        foreach ($filters as $key => $value) {
            if ($value instanceof ArrayCollection) {
                $filters[$key] = $filters[$key]->map(
                    function ($entity) {
                        return $entity->getId();
                    }
                )->toArray();

            } else if (is_array($value)) {
                foreach ($value as $_key => $_value) {
                    if ($this->filterIsEntity($_value)) {
                        $filters[$key][$_key] = $_value->getId();
                    }
                }

            } else if ($this->filterIsEntity($value)) {
                $filters[$key] = $value->getId();
            }
        }

        return $filters;
    }