private static DirectoryDescriptor FromPathDirectoryInfo(DirectoryInfo directoryInfo, IProgress <PorcentageProgress> progress, WorkContext current)
        {
            DirectoryInfo[] directories;
            try
            {
                directories = directoryInfo.GetDirectories();
            }
            catch (DirectoryNotFoundException)
            {
                return(new DirectoryDescriptor(directoryInfo.Name, false));
            }
            catch (PathTooLongException)
            {
                return(new DirectoryDescriptor(directoryInfo.Name, false));
            }
            catch (UnauthorizedAccessException)
            {
                return(new DirectoryDescriptor(directoryInfo.Name, false));
            }

            var res = new DirectoryDescriptor(directoryInfo.Name, true);

            foreach (var directory in directories)
            {
                var child = FromPathDirectoryInfo(directory, progress, current);
                res.Directories.Add(child);
            }
            foreach (var fileInfo in directoryInfo.GetFiles())
            {
                var file = new FileDescriptor(fileInfo.Name, fileInfo.Length);
                res.Files.Add(file);
                current.Current++;
                progress.Report(current.GetProgress());
            }
            return(res);
        }