def METHOD_NAME(session, db_kb: "DbKnowledgeBase", code_manager: StructuredCodeManager):
    """
    :param session:
    :param db_kb:
    :param code_manager:
    :return:
    """
    # remove all existing stored structured code
    session.query(DbStructuredCode).filter_by(kb=db_kb).delete()
    for key, cache in code_manager.cached.items():
        func_addr, flavor = key
        # TODO: Cache types
        expr_comments = None
        if cache.codegen.expr_comments:
            expr_comments = json.dumps(cache.codegen.expr_comments).encode("utf-8")
        stmt_comments = None
        if cache.codegen.stmt_comments:
            stmt_comments = json.dumps(cache.codegen.stmt_comments).encode("utf-8")
        const_formats = None
        if cache.codegen.const_formats:
            const_formats = pickle.dumps(cache.codegen.const_formats)
        ite_exprs = None
        if cache.ite_exprs:
            ite_exprs = pickle.dumps(cache.ite_exprs)
        db_code = DbStructuredCode(
            kb=db_kb,
            func_addr=func_addr,
            flavor=flavor,
            expr_comments=expr_comments,
            stmt_comments=stmt_comments,
            const_formats=const_formats,
            ite_exprs=ite_exprs,
            # configuration=configuration,
        )
        session.add(db_code)