private function parseSort(array $sort)
    {
        $out = '';
        if (!empty($sort)) {
            $conditions = [];
            foreach ($sort as $field => $direction) {
                $direction = $direction ? 'DESC' : 'ASC';
                $conditions[] = sprintf('%s %s', $field, $direction);
            }
            $out = sprintf(' ORDER BY %s', implode(', ', $conditions));
        }
        return $out;
    }