protected function sortList(array &$list, array $allowed, array $query, array $default = array())
    {
        if (empty($default)) {
            $default = array('sort' => '', 'order' => '');
        } else {
            $order = reset($default);
            $field = key($default);
            $default = array('sort' => $field, 'order' => $order);
        }

        $query += $default;

        if (in_array($query['sort'], $allowed)) {
            uasort($list, function ($a, $b) use ($query) {
                return $this->callbackSortList($a, $b, $query);
            });
        }
    }