I have an MVC web-app with a REST endpoint that receives JSON formatted data which needs to be parsed, validated and persisted to the database. The REST endpoint is mapped to a controller function.
What I need to know is where the parsing, validation and persistence should take place. Should it be done in the controller function that is mapped to the REST endpoint or should I be using the controller to simply route the data to the model layer for processing? What is the recommended way of handling this scenario?