Factoring json error handling out into base controller