Refactor some code in obj_create for the Sample resource
Clarify comments