private bool CheckAllChildrenVisible(ref FolderInfo folder)
        {
            string virtualPath = FileSystemValidation.ToVirtualPath(folder.FolderPath);

            //check files are visible
            IDictionary <string, Services.FileSystem.FileInfo> files = GetDNNFiles(folder.FolderID);
            int visibleFileCount = 0;

            foreach (Services.FileSystem.FileInfo fileItem in files.Values)
            {
                string[] tempVar = SearchPatterns;
                if (CheckSearchPatterns(fileItem.FileName, ref tempVar))
                {
                    visibleFileCount = visibleFileCount + 1;
                }
            }

            if (visibleFileCount != Directory.GetFiles(HttpContext.Current.Request.MapPath(virtualPath)).Length)
            {
                return(false);
            }

            //check folders
            if (folder != null)
            {
                IDictionary <string, FolderInfo> childUserFolders = DNNValidator.GetChildUserFolders(virtualPath);

                if (childUserFolders.Count != Directory.GetDirectories(HttpContext.Current.Request.MapPath(virtualPath)).Length)
                {
                    return(false);
                }

                //check children
                foreach (FolderInfo childFolder in childUserFolders.Values)
                {
                    //do recursive check
                    FolderInfo tempVar2 = childFolder;
                    if (!(CheckAllChildrenVisible(ref tempVar2)))
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }