public static Collection<? extends Bean> attachParentBeansFromMethods(Set<Bean> beansCollection){
        Map<Bean,Bean> map = new HashMap<Bean, Bean>();
        Set<Bean> beansWithParents = new HashSet<Bean>();

        for (Bean beanFromCollection : beansCollection) {
            for (Bean beanInjected  : beanFromCollection.getChildren()) {
                map.put(beanInjected,beanFromCollection);
            }
        }

        for (Bean bean : beansCollection) {
            Set<Bean> beansParent= new HashSet<Bean>();
            if(map.get(bean)!=null){
                beansParent.add(map.get(bean));
                bean.setParents(beansParent);
                beansWithParents.add(bean);
            }
        }

        return beansWithParents;
    }