There's a lot of duplication in these `handle_session_*` methods. Can that be factored out to make it clearer what the differences are?