abstracted error, redirect, and json response logic into ControllerBase and Model classes