'Generate a tree from comments and overwrite any existing tree.'

@classmethod
def rebuild(cls, link, comments):

    with cls._mutation_context(link) as lock:
        tree = {}
        for comment in comments:
            tree.setdefault(comment.parent_id, []).append(comment._id)
        cls._write_tree(link, tree, lock)
