Writing function to assemble object, working on iteration and association logic