public function getSorting(Request $request, $ignoreSession = false)
    {
        if ($ignoreSession) {
            return $this->getSortingFromRequest($request);
        }

        $sorting = array_replace(
            $this->getSortingFromSession($request->getSession()),
            $this->getSortingFromRequest($request)
        );

        $this->saveSorting($request->getSession(), $sorting);
        return $sorting;
    }