When parent exists, make sure the created resource is associated

Perhaps I'm missing something really obvious, but I was surprised to find that when a resource has a parent, it does not get created under the parent.

This PR makes sure that a child object is correctly associated with its parent upon its creation.