public static function addSorting(ConfigInterface $config, QueryBuilder $queryBuilder)
    {
        if (empty($config->getSorting()) || !is_array($config->getSorting())) {
            return;
        }

        foreach ($config->getSorting() as $sort => $order) {
            // array could be a simple field list or list of field => direction combinations.
            if (!empty($order)) {
                $order = strtoupper($order);
                if (!in_array($order, [DCGE::MODEL_SORTING_ASC, DCGE::MODEL_SORTING_DESC])) {
                    $sort  = $order;
                    $order = DCGE::MODEL_SORTING_ASC;
                }
            } else {
                $order = DCGE::MODEL_SORTING_ASC;
            }

            $queryBuilder->addOrderBy($sort, $order);
        }
    }