private ChangedFolder CreateNode(string path)
        {
            ChangedFolder folder = null;

            treeView.Invoke((MethodInvoker) delegate
            {
                var oldTopNode = treeView.TopNode;
                var name       = Path.GetFileName(path);
                if (path.Equals(_rootFolder, StringComparison.CurrentCultureIgnoreCase))
                {
                    name = path;
                }
                folder = new ChangedFolder(path, new TreeNode(name));
                _nodes[path.ToLower()] = folder;
                folder.Node.ExpandAll();
                folder.Node.SelectedImageIndex = folder.Node.ImageIndex = _icons.GetIcon(path);
                treeView.TopNode = oldTopNode;
            });
            return(folder);
        }
        private ChangedFolder GetOrCreateNode(string path, WatcherChangeTypes changeType)
        {
            var changedUsername = _filePropertiesExtractor.GetSpecificFileProperties(path, 10);

            _logWriter.Write("User: "******"; Path: " + path + "; Type: " + changeType);

            ChangedFolder folder;
            var           lowerCaseName = Path.GetFullPath(path).ToLower();

            if (lowerCaseName == _rootFolder.ToLower())
            {
                ChangedFolder tag = null;
                treeView.Invoke((MethodInvoker) delegate {
                    tag = (ChangedFolder)treeView.Nodes[0].Tag;
                });
                return(tag);
            }
            if (!_nodes.TryGetValue(lowerCaseName, out folder))
            {
                treeView.Invoke((MethodInvoker) delegate {
                    var parentNode = GetOrCreateNode(Path.GetDirectoryName(path), WatcherChangeTypes.Changed);
                    folder         = CreateNode(path);
                    parentNode.Node.Nodes.Add(folder.Node);
                    if (parentNode.Node.Nodes.Count == 1)
                    {
                        parentNode.Node.ExpandAll();
                    }
                });
            }
            if (changeType == WatcherChangeTypes.Deleted)
            {
                folder.MarkAllAsDeleted();
            }

            if (!(changeType == WatcherChangeTypes.Changed && folder.Status == WatcherChangeTypes.Created))
            {
                folder.Status = changeType;
            }
            return(folder);
        }