Factoring out bootstrap modal logic.