public static function initializeSorting($panel, $dataConfig, $listingConfig)
    {
        // Store default sorting start initializing the panel with an empty sorting.
        $sorting = $dataConfig->getSorting();
        $dataConfig->setSorting([]);
        $panel->initialize($dataConfig);

        // Restore default sorting if panel did not set any.
        if ($sorting && !$dataConfig->getSorting()) {
            $dataConfig->setSorting($sorting);
        }

        // Initialize sorting if not present yet.
        if (!$dataConfig->getSorting() && $listingConfig->getGroupAndSortingDefinition()->hasDefault()) {
            $newSorting = [];
            foreach ($listingConfig->getGroupAndSortingDefinition()->getDefault() as $information) {
                /** @var GroupAndSortingInformationInterface $information */
                $newSorting[$information->getProperty()] = \strtoupper($information->getSortingMode());
            }
            $dataConfig->setSorting($newSorting);
        }
    }