This helps with views that can return a AJAX response. We store the messages temporarily then apply them to the request, or serialise to JSON at the end.