List<Integer> missed = new ArrayList<Integer>();
MailItem.TypedIdList missed = new MailItem.TypedIdList();
    public static Pair<List<UnderlyingData>,List<Integer>> getModifiedItems(Mailbox mbox, byte type, long lastSync, Set<Integer> visible)    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        if (visible != null && visible.isEmpty())            return new Pair<List<UnderlyingData>,List<Integer>>(EMPTY_DATA, EMPTY_INTEGER);        Connection conn = mbox.getOperationConnection();        List<UnderlyingData> result = new ArrayList<UnderlyingData>();        List<Integer> missed = new ArrayList<Integer>();        PreparedStatement stmt = null;        ResultSet rs = null;        try {            String typeConstraint = type == MailItem.TYPE_UNKNOWN ? "type NOT IN " + NON_SEARCHABLE_TYPES : "type IN " + typeConstraint(type);            stmt = conn.prepareStatement("SELECT " + DB_FIELDS +                    " FROM " + getMailItemTableName(mbox, "mi") +                    " WHERE " + IN_THIS_MAILBOX_AND + "mi.mod_metadata > ? AND " + typeConstraint +                    " ORDER BY mi.mod_metadata");            int pos = 1;            if (!DebugConfig.disableMailboxGroup)                stmt.setInt(pos++, mbox.getId());            stmt.setLong(pos++, lastSync);            rs = stmt.executeQuery();            while (rs.next()) {                if (visible == null || visible.contains(rs.getInt(CI_FOLDER_ID)))                    result.add(constructItem(rs));                else                    missed.add(rs.getInt(CI_ID));            }            if (type == MailItem.TYPE_CONVERSATION)                completeConversations(mbox, result);            return new Pair<List<UnderlyingData>,List<Integer>>(result, missed);        } catch (SQLException e) {            throw ServiceException.FAILURE("getting items modified since " + lastSync, e);        } finally {            DbPool.closeResults(rs);            DbPool.closeStatement(stmt);        }    }