// since we don't know the actual item count we try to load one item more than requested
// if there are n+1 items we know there will be something on the next page
// get the actual items
List<Contact> resultList = database.find(query.getFrom(), query.getCount() + 1, sortProperty, sortAsc);
result.setItems(resultList.iterator());
if (resultList.size() == query.getCount() + 1) {
// if we managed to load n + 1 items (thus there will be another page)
result.setTotalCount(IQueryResult.MORE_ITEMS);