for (MailItem item : mbox.getModifiedItems(octxt, type, begin)) {
for (Tag tag : mbox.getModifiedTags(octxt, begin)) ToXML.encodeTag(response, zsc, tag, Change.ALL_FIELDS);
    private void deltaSync(ZimbraSoapContext zsc, Element response, Mailbox mbox, long begin) throws ServiceException {        if (begin >= mbox.getLastChangeID())            return;        // first, handle deleted items        List<Integer> tombstones = mbox.getTombstones(begin);        if (tombstones != null && !tombstones.isEmpty()) {            StringBuilder deleted = new StringBuilder();            for (Integer id : tombstones)                deleted.append(deleted.equals("") ? "" : ",").append(id);            response.addElement(MailService.E_DELETED).addAttribute(MailService.A_IDS, deleted.toString());        }        //  now, handle created/modified items        OperationContext octxt = zsc.getOperationContext();        for (byte type : SYNC_ORDER) {            if (type == MailItem.TYPE_FOLDER && zsc.isDelegatedRequest()) {                //  first, make sure that something changed...                OperationContext octxtOwner = new OperationContext(mbox.getAccount());                if (mbox.getModifiedItems(octxtOwner, type, begin).isEmpty())                    continue;                // special-case the folder hierarchy for delegated delta sync                Set<Folder> visible = mbox.getVisibleFolders(octxt);                boolean anyFolders = folderSync(zsc, response, mbox, mbox.getFolderById(null, DEFAULT_FOLDER_ID), visible, SyncPhase.DELTA);                // if no folders are visible, add an empty "<folder/>" as a hint                if (!anyFolders)                    response.addElement(MailService.E_FOLDER);                continue;            }            for (MailItem item : mbox.getModifiedItems(octxt, type, begin)) {                //      For items in the system, if the content has changed since the user last sync'ed                 //      (because it was edited or created), just send back the folder ID and saved date --                //      the client will request the whole object out of band -- potentially using the                 //      content servlet's "include metadata in headers" hack.                //      If it's just the metadata that changed, send back the set of mutable attributes.                boolean isMetadataOnly = type == MailItem.TYPE_FOLDER || type == MailItem.TYPE_TAG;                if (!isMetadataOnly && item.getSavedSequence() > begin)                    ToXML.encodeItem(response, zsc, item, Change.MODIFIED_FOLDER | Change.MODIFIED_CONFLICT);                else                    ToXML.encodeItem(response, zsc, item, isMetadataOnly ? Change.ALL_FIELDS : MUTABLE_FIELDS);            }        }    }