return result;
return new Pair<List<UnderlyingData>,List<Integer>>(result, missed);
    public static List<UnderlyingData> getModifiedItems(Mailbox mbox, byte type, long lastSync) throws ServiceException {        if (Mailbox.isCachedType(type))            throw ServiceException.INVALID_REQUEST("folders and tags must be retrieved from cache", null);        // figure out what folders are visible and thus also if we can short-circuit this query        Set<Folder> visible = mbox.getVisibleFolders();        if (visible != null && visible.isEmpty())            return Collections.emptyList();        Connection conn = mbox.getOperationConnection();        List<UnderlyingData> result = new ArrayList<UnderlyingData>();        PreparedStatement stmt = null;        ResultSet rs = null;        try {            stmt = conn.prepareStatement("SELECT " + DB_FIELDS +                    " FROM " + getMailItemTableName(mbox.getId(), "mi") +                    " WHERE type IN " + typeConstraint(type) +                    (visible == null ? "" : " AND folder_id IN" + DbUtil.suitableNumberOfVariables(visible)) +                     " AND mi.mod_metadata > ? ORDER BY mi.mod_metadata");            int attr = 1;            if (visible != null)                for (Folder folder : visible)                    stmt.setInt(attr++, folder.getId());            stmt.setLong(attr++, lastSync);            rs = stmt.executeQuery();            while (rs.next())                result.add(constructItem(rs));            if (type == MailItem.TYPE_CONVERSATION)                completeConversations(mbox, result);            return result;        } catch (SQLException e) {            throw ServiceException.FAILURE("getting items modified since " + lastSync, e);        } finally {            DbPool.closeResults(rs);            DbPool.closeStatement(stmt);        }    }