public Tag Convert(ITagEntity tagEntity, OnObjectCreation onObjectCreation) { //compose Tag List <Product> products = new List <Product>(); Tag tag = domainFactory.CreateTag(tagEntity.Id , tagEntity.Name , products); // handle instantiated tags. Needed by repository to prevent looping. onObjectCreation(tag, tagEntity); // gather child objects: products foreach (ProductTagEntity productTagEntity in tagEntity.ProductTagEntities) { Product product = repositoryFactory.ProductsRepository.Get(productTagEntity.ProductId); products.Add(product); } return(tag); }