Inheritance: Umbraco.Web.Editors.UmbracoAuthorizedJsonController
        private TreeNodeCollection AddFolders(string parent, FormDataCollection queryStrings)
        {
            var pickerApiController = new FilePickerApiController();

            var filter = queryStrings.Get("filter").Split(',').Select(a => a.Trim().EnsureStartsWith(".")).ToArray();

            var treeNodeCollection = new TreeNodeCollection();
            treeNodeCollection.AddRange(pickerApiController.GetFolders(parent,filter)
                .Select(dir => CreateTreeNode(dir.FullName.Replace(IOHelper.MapPath("~"), "").Replace("\\", "/"),
                    "~/" + parent, queryStrings, dir.Name,
                    "icon-folder", filter[0]=="." ? dir.EnumerateDirectories().Any() || pickerApiController.GetFiles(dir.FullName.Replace(IOHelper.MapPath("~"), "").Replace("\\", "/"), filter).Any() : pickerApiController.GetFiles(dir.FullName.Replace(IOHelper.MapPath("~"), "").Replace("\\", "/"), filter).Any())));

            return treeNodeCollection;
        }
        private TreeNodeCollection AddFolders(string parent, FormDataCollection queryStrings)
        {
            var pickerApiController = new FilePickerApiController();

            var filter = queryStrings.Get("filter").Split(',').Select(a => a.Trim().EnsureStartsWith(".")).ToArray();

            var treeNodeCollection = new TreeNodeCollection();

            treeNodeCollection.AddRange(pickerApiController.GetFolders(parent, filter)
                                        .Select(dir => CreateTreeNode(dir.FullName.Replace(IOHelper.MapPath("~"), "").Replace("\\", "/"),
                                                                      "~/" + parent, queryStrings, dir.Name,
                                                                      "icon-folder", filter[0] == "." ? dir.EnumerateDirectories().Any() || pickerApiController.GetFiles(dir.FullName.Replace(IOHelper.MapPath("~"), "").Replace("\\", "/"), filter).Any() : pickerApiController.GetFiles(dir.FullName.Replace(IOHelper.MapPath("~"), "").Replace("\\", "/"), filter).Any())));

            return(treeNodeCollection);
        }
        private TreeNodeCollection AddFiles(string folder, FormDataCollection queryStrings)
        {
            var pickerApiController = new FilePickerApiController();
            //var str = queryStrings.Get("startfolder");

            if (string.IsNullOrWhiteSpace(folder))
                return null;

            var filter = queryStrings.Get("filter").Split(',').Select(a=>a.Trim().EnsureStartsWith(".")).ToArray();

            var path = IOHelper.MapPath(folder);
            var rootPath = IOHelper.MapPath(queryStrings.Get("startfolder"));
            var treeNodeCollection = new TreeNodeCollection();
            treeNodeCollection.AddRange(pickerApiController.GetFiles(folder, filter)
                .Select(file => CreateTreeNode(file.FullName.Replace(rootPath, "").Replace("\\", "/"),
                    path, queryStrings, file.Name, "icon-document", false)));

            return treeNodeCollection;
        }
        private TreeNodeCollection AddFiles(string folder, FormDataCollection queryStrings)
        {
            var pickerApiController = new FilePickerApiController();

            //var str = queryStrings.Get("startfolder");

            if (string.IsNullOrWhiteSpace(folder))
            {
                return(null);
            }

            var filter = queryStrings.Get("filter").Split(',').Select(a => a.Trim().EnsureStartsWith(".")).ToArray();


            var path               = IOHelper.MapPath(folder);
            var rootPath           = IOHelper.MapPath(queryStrings.Get("startfolder"));
            var treeNodeCollection = new TreeNodeCollection();

            treeNodeCollection.AddRange(pickerApiController.GetFiles(folder, filter)
                                        .Select(file => CreateTreeNode(file.FullName.Replace(rootPath, "").Replace("\\", "/"),
                                                                       path, queryStrings, file.Name, "icon-document", false)));

            return(treeNodeCollection);
        }