if (sortKey != null) {
Integer sortType = sortKey.getSortType();
if (sortType != null) {
queryContext.sort(new Sort(new SortField(sortKey.dbName(), sortType, sortDescending)));
} else {
queryContext.sort(new Sort(new SortField(sortKey.dbName(), Locale.getDefault(), sortDescending)));
}