private static IEnumerable <T> FindAllComponents <T>(this IQueryComponentNavigator queryComponentNavigator, IList <Query> searchedQueries) where T : IQueryComponent
        {
            List <T> result = new List <T>();
            Query    query  = null;

            if (queryComponentNavigator is QueryNavigator)
            {
                query = (Query)queryComponentNavigator.GetQueryComponent();
                if ((!searchedQueries.Contains(query)) && (searchedQueries.Count < 2))
                {
                    searchedQueries.Add(query);
                    if ((query != null) && (query.OwnerQuery != null))
                    {
                        result.AddUniqueRange(query.OwnerQuery.GetQueryComponentNavigator().FindAllComponents <T>(searchedQueries));
                    }
                }
                else
                {
                    query = null;
                }
            }

            foreach (IQueryComponent component in queryComponentNavigator.GetComponents())
            {
                if ((typeof(T).IsAssignableFrom(component.GetType())) && (!result.Contains((T)component)))
                {
                    result.Add((T)component);
                }

                IQueryComponentNavigator componentNavigator = component.GetQueryComponentNavigator();
                if ((componentNavigator != null) && ((!(component is Query)) || (!searchedQueries.Contains((Query)component))))
                {
                    result.AddUniqueRange(componentNavigator.FindAllComponents <T>(searchedQueries));
                }
            }

            return(result.AsReadOnly());
        }
        internal static bool Contains(this IQueryComponentNavigator navigator, IQueryComponent component)
        {
            bool result = navigator.ContainsComponent(component);

            if (!result)
            {
                foreach (IQueryComponent childComponent in navigator.GetComponents())
                {
                    IQueryComponentNavigator childNavigator = childComponent.GetQueryComponentNavigator();
                    if (childNavigator != null)
                    {
                        bool localResult = childNavigator.Contains(component);
                        if (localResult)
                        {
                            result = localResult;
                            break;
                        }
                    }
                }
            }

            return(result);
        }