Get only links from manage links

Hi, the reporting links keeps getting nested links from linked models. How do I just get the list of links in the manage links list as a link instance to pin? thanks

I figured out how to get only the mange links list but only with element type from links. Not sure how to get the instance from element type to pin

So you list the first item from the link instances. Then check the link types if its nested and get your list of only ones in the manage links list.