Added pre- and post- validation for PUT and POST

I refined my earlier approach to allow validation on either the
input data to the POST/PUT request or the resulting Resource
object that is the result of the request (prior to saving it).
Merge branch 'extended_validation'