Refactor resource post logic

This commit changes the way a new record is created on a post. As it was
previously, a post with invalid data would result in a record not being
created. When going into the else portion of post, record would be nil
and would result in a NoMethodError. To resolve this issue, instead we
instantiate a new object based on the klass. Then we call save on the
object and use this to determine if the record was created or not. This
will allow any validations to run on the newly created object and
populate the errors array if any validations didn't pass.