Box2D ContactList

So bear with me on this, Here is what i am trying to do, i have a picture to explain it better. So Let's say I have 3 Orange balls that are next each other, if a user clicks on one of them, i want my function to loop and find the next contact list, if the contact is orange in color, then loop until there is no more Orange contacts. You can assume, that I will check for color later, i know im not doing it because i enter an infinite loop if the body.GetUserData()!=null, so I am trying to fix it but I don't know how.



Code:
private List<Body> recursiveFind(Body body)
        {
           
            for (var c = body.GetContactList(); c != null; c = c.Next)
            {
                var body1 = c.Contact.GetFixtureA().GetBody();
                var body2 = c.Contact.GetFixtureB().GetBody();

                if(body1.GetUserData()!=null)
                {
                    myList.Add(body1);
                    recursiveFind(body1);
                }
                if (body2.GetUserData() != null)
                {
                    myList.Add(body2);
                    recursiveFind(body2);
                }
               
             
            }
            return myList;

        }




Image
http://www.gamemummy.com/samephysics/ here is what i sort of want. Notice how when u however over a box, all the nearby boxes get highlighted too.
You should perform a bread-first search: http://en.wikipedia.org/wiki/Breadth-first_search

Original thread: https://box2d.org/forum/viewtopic.php?t=5176