Return everything back to the controller

Each {model}API file was using die() with the appropriate HTTP response
code to indicate error status. This made unit testing difficult so now
everything is pushed back to the controller where it is encoded to JSON
and echoed.