but tvItem is not declared. is it possible to return the collection?
You are getting the error, "tvItem is not declared" because it is just the definition of the data type - not an instance of the data type. When using user defined types, you have to create an instance of the type in order to use it as a returnable type in your function. You should use "MyCollection" as the return instead. Also, this my just be a typo, but your declaration of "MyCollectiontvItem" should be "MyCollection tvItem".