Commits the changes for all the items in the tree.
        
        :return     <bool> | success

def commit(self):
        """
        Commits the changes for all the items in the tree.
        
        :return     <bool> | success
        """
        remove_items = []
        commit_items = []
        
        # remove all the items
        commit_state = XOrbRecordItem.State.Modified | XOrbRecordItem.State.New
        remove_state = XOrbRecordItem.State.Removed
        for i in range(self.topLevelItemCount()):
            item = self.topLevelItem(i)
            
            if isinstance(item, XOrbRecordItem) or\
                isinstance(item, XOrbGroupItem):
                remove_items += item.findItemsByState(remove_state)
                commit_items += item.findItemsByState(commit_state)
        
        # make sure we can remove the records
        for item in remove_items:
            record = item.record()
            try:
                record.remove(dryRun = True, throw=True)
            except orb.errors.CannotRemoveError, err:
                QMessageBox.information(self,
                                        'Cannot Remove',
                                        nativestring(err))
                return False
        
        # remove the records
        remove_set = RecordSet([item.record() for item in remove_items])
        remove_set.remove()
        
        for item in remove_items:
            item.record().remove()
            parent = item.parent()
            if parent:
                index = parent.indexOfChild(item)
                parent.takeChild(index)
            else:
                index = self.indexOfTopLevelItem(item)
                self.takeTopLevelItem(index)
        
        # commit the new records
        for item in commit_items:
            self.aboutToSaveRecord.emit(item.record())
            item.record().commit()
            item.setRecordState(XOrbRecordItem.State.Normal)
        
        self.recordsCommitted.emit()
        
        return True