/// <summary>
        /// Add <paramref name="archiveEntries"/> into tree structure.
        /// </summary>
        /// <param name="root"></param>
        /// <param name="archiveEntries"></param>
        /// <param name="streamProvider">stream provider for files</param>
        /// <param name="convertBackslashesToSlashes">if true converts '\' to '/'</param>
        /// <returns>this</returns>
        protected virtual Lexical.FileProvider.Common.ArchiveDirectoryEntry AddArchiveEntries(Lexical.FileProvider.Common.ArchiveDirectoryEntry root, IEnumerable <IArchiveEntry> archiveEntries, Lexical.FileProvider.Common.IStreamProvider streamProvider, bool convertBackslashesToSlashes)
        {
            foreach (IArchiveEntry entry in archiveEntries)
            {
                string path = convertBackslashesToSlashes ? entry.Key.Replace('\\', '/') : entry.Key;

                // Is entry a file
                if (!entry.IsDirectory)
                {
                    // Split to filename and path
                    int    slashIx  = path.LastIndexOf('/');
                    string filename = path.Substring(slashIx + 1);
                    string dirPath  = slashIx < 0 ? "" : path.Substring(0, slashIx);

                    // Create file entry
                    Lexical.FileProvider.Common.ArchiveFileEntry fileEntry = new Lexical.FileProvider.Common.ArchiveFileEntry(streamProvider, entry.Key, filename, entry.Size, entry.LastModifiedTime ?? DateTime.MinValue);

                    // Create dir
                    Lexical.FileProvider.Common.ArchiveDirectoryEntry dir = root.GetOrCreateDirectory(dirPath);

                    // Add to dir
                    dir.files[filename] = fileEntry;
                }
                else
                {
                    // Create dir
                    var dir = root.GetOrCreateDirectory(path);
                    if (entry.LastModifiedTime != null)
                    {
                        dir.LastModified = (DateTime)entry.LastModifiedTime;
                    }
                }
            }

            // Return the whole tree
            return(root);
        }