private function buildSortParameters(ParameterBuilderInterface $builder, array $groups = [], array $allowedSortTypes = []): void
    {
        $sortTypes = [
            'Published' => 'date_published',
            'Modified' => 'date_modified',
            'Alphabetical' => 'content_name',
            'Priority' => 'location_priority',
            'Defined by parent' => 'defined_by_parent',
        ];

        if (count($allowedSortTypes) > 0) {
            $sortTypes = array_intersect($sortTypes, $allowedSortTypes);
        }

        $builder->add(
            'sort_type',
            ParameterType\ChoiceType::class,
            [
                'required' => true,
                'options' => $sortTypes,
                'groups' => $groups,
            ]
        );

        $builder->add(
            'sort_direction',
            ParameterType\ChoiceType::class,
            [
                'required' => true,
                'options' => [
                    'Descending' => LocationQuery::SORT_DESC,
                    'Ascending' => LocationQuery::SORT_ASC,
                ],
                'groups' => $groups,
            ]
        );
    }