'Update the persisted version of xblock to reflect its current values.
xblock: which xblock to persist
user_id: who made the change (ignored for now by this modulestore)
allow_not_found: whether to create a new object if one didn\'t already exist or give an error
force: force is meaningless for this modulestore
isPublish: an internal parameter that indicates whether this update is due to a Publish operation, and
thus whether the item\'s published information should be updated.
is_publish_root: when publishing, this indicates whether xblock is the root of the publish and should
therefore propagate subtree edit info up the tree'

def update_item(self, xblock, user_id, allow_not_found=False, force=False, isPublish=False, is_publish_root=True):

    course_key = xblock.location.course_key
    try:
        definition_data = self._serialize_scope(xblock, Scope.content)
        now = datetime.now(UTC)
        payload = {'definition.data': definition_data, 'metadata': self._serialize_scope(xblock, Scope.settings), 'edit_info': {'edited_on': now, 'edited_by': user_id, 'subtree_edited_on': now, 'subtree_edited_by': user_id}}
        if isPublish:
            payload['edit_info']['published_date'] = now
            payload['edit_info']['published_by'] = user_id
        elif ('published_date' in getattr(xblock, '_edit_info', {})):
            payload['edit_info']['published_date'] = xblock._edit_info['published_date']
            payload['edit_info']['published_by'] = xblock._edit_info['published_by']
        if xblock.has_children:
            children = self._serialize_scope(xblock, Scope.children)
            payload.update({'definition.children': children['children']})
            parent_cache = self._get_parent_cache(self.get_branch_setting())
            parent_cache.delete_by_value(xblock.location)
            for child in xblock.children:
                parent_cache.set(unicode(child), xblock.location)
        self._update_single_item(xblock.scope_ids.usage_id, payload, allow_not_found=allow_not_found)
        if ((not isPublish) or (isPublish and is_publish_root)):
            ancestor_payload = {'edit_info.subtree_edited_on': now, 'edit_info.subtree_edited_by': user_id}
            self._update_ancestors(xblock.scope_ids.usage_id, ancestor_payload)
        xblock._edit_info = payload['edit_info']
        self.refresh_cached_metadata_inheritance_tree(xblock.scope_ids.usage_id.course_key, xblock.runtime)
    except ItemNotFoundError:
        if (not allow_not_found):
            raise
        elif (not self.has_course(course_key)):
            raise ItemNotFoundError(course_key)
    return xblock
