Handling flash messages for modals