I'm fairly new to Sinatra (like < 5 hours ago) and I'm noticing a pattern on my POSTs (and the other keywords too)

```
post '/pageant' do
pageant = Pageant.new(params)
if pageant.save
    json_status 201, 'good'
    Pageant.last.to_json
else
    json_status 412, 'fail'
end
end

```

I have other models: for the candidates, the judges, the categories, the scores, etc. I feel like I'm going to be writing this multiple times: Get the parameters, attempt to save, if everything is valid (according to DataMapper), send a 201 or 200 and return the last, else throw an error (json\_status is a method that throws an error status and error code). The same happens for DELETE: "check if deleted, if deleted send OK, if not send error"... How do I DRY this thing? I'd definitely appreciate the help.