tagsets.applyMask(tag.getBitmask(), add);
tagsets.addTagset(item.getTagBitmask());
    public static void alterTag(Tag tag, MailItem.Array itemIDs, boolean add)    throws ServiceException {        if (itemIDs == null || itemIDs.length == 0)            return;        Mailbox mbox = tag.getMailbox();        Connection conn = mbox.getOperationConnection();        PreparedStatement stmt = null;        try {            String column = (tag instanceof Flag ? "flags" : "tags");            stmt = conn.prepareStatement("UPDATE " + getMailItemTableName(tag) +                    " SET " + column + " = " + column + (add ? " | ?" : " & ?") + ", mod_metadata = ?" +                    " WHERE id IN " + suitableNumberOfVariables(itemIDs));            stmt.setLong(1, add ? tag.getBitmask() : ~tag.getBitmask());            stmt.setInt(2, mbox.getOperationChangeID());            for (int i = 0; i < itemIDs.length; i++)                stmt.setInt(i + 3, itemIDs.array[i]);            stmt.executeUpdate();            // Update the flagset or tagset cache.  Assume that the item's in-memory            // data has already been updated.            if (tag instanceof Flag) {                TagsetCache flagsets = getFlagsetCache(conn, mbox.getId());                flagsets.applyMask(tag.getBitmask(), add);            } else {                TagsetCache tagsets = getTagsetCache(conn, mbox.getId());                tagsets.applyMask(tag.getBitmask(), add);            }        } catch (SQLException e) {            throw ServiceException.FAILURE("updating tag data for items [" + itemIDs + "]", e);        } finally {            DbPool.closeStatement(stmt);        }    }