'Switch to a new different history'

def _list_switch(self, trans, histories):

    new_history = histories[0]
    galaxy_session = trans.get_galaxy_session()
    try:
        association = trans.sa_session.query(trans.app.model.GalaxySessionToHistoryAssociation).filter_by(session_id=galaxy_session.id, history_id=new_history.id).first()
    except:
        association = None
    new_history.add_galaxy_session(galaxy_session, association=association)
    trans.sa_session.add(new_history)
    trans.sa_session.flush()
    trans.set_history(new_history)
    return (None, None)
