code: public void afterPhase(final PhaseEvent event)
     {
        if (!PhaseId.RENDER_RESPONSE.equals(event.getPhaseId()))
        {
           FacesContext facesContext = event.getFacesContext();
           messagesUtils.saveMessages(facesContext, facesContext.getExternalContext().getSessionMap());
        }
     }
docs: /*
  Save messages into the session after every phase.