public static void ProcessTridionItem(MappingInfo mapping, ItemInfo item, TridionFolderInfo folder)
        {
            //todo: nested folders?

            if (item == null || folder == null)
                return;

            if (!folder.ScanForItems)
                return;

            if (mapping.ProjectFolders.Any(projectFolder => projectFolder.ExistsTcmId(item.TcmId)))
                return;

            if (folder.TridionRole == TridionRole.PageLayoutContainer || folder.TridionRole == TridionRole.ComponentLayoutContainer)
            {
                TemplateBuildingBlockData tridionItem = ReadItem(mapping, item.TcmId) as TemplateBuildingBlockData;
                if (tridionItem == null || tridionItem.VersionInfo.RevisionDate == null)
                    return;

                ShowMessage(item.Title + "...");

                if (ProjectDestination_Skip)
                {
                    //skip checkbox is pressed

                    ProjectFolderInfo projectFolder = null;
                    if (folder.TridionRole == TridionRole.PageLayoutContainer)
                    {
                        projectFolder = mapping.ProjectFolders.FirstOrDefault(x => x.ProjectFolderRole == ProjectFolderRole.PageLayout);
                    }
                    if (folder.TridionRole == TridionRole.ComponentLayoutContainer)
                    {
                        projectFolder = mapping.ProjectFolders.FirstOrDefault(x => x.ProjectFolderRole == ProjectFolderRole.ComponentLayout);
                    }
                    if (projectFolder == null)
                        projectFolder = new ProjectFolderInfo();

                    if (projectFolder.ChildItems == null)
                        projectFolder.ChildItems = new List<ProjectItemInfo>();

                    string path = Path.Combine(projectFolder.Path, item.Title.Replace(".cshtml", "") + ".cshtml");

                    ProjectFileInfo projectFile = projectFolder.ChildItems.OfType<ProjectFileInfo>().FirstOrDefault(x => x.Path == path) ?? new ProjectFileInfo();
                    projectFile.Parent = projectFolder;
                    projectFile.RootPath = projectFolder.RootPath;
                    projectFile.Path = path;
                    projectFile.TcmId = item.TcmId;
                    projectFile.Checked = true;
                    projectFile.SyncTemplate = Common.IsolatedStorage.Service.GetFromIsolatedStorage(Common.IsolatedStorage.Service.GetId(mapping.Host, "ProjectDestination_SyncTemplate")) == "true";

                    if (projectFolder.ChildItems.OfType<ProjectFileInfo>().All(x => x.Path != path))
                    {
                        projectFolder.ChildItems.Add(projectFile);
                    }

                    string fullPath = projectFile.FullPath;
                    DateTime tridionDate = (DateTime)tridionItem.VersionInfo.RevisionDate;
                    DateTime tridionLocalDate = tridionDate.GetLocalTime(mapping.TimeZoneId);
                    SaveVSItem(fullPath, tridionItem.Content);
                    File.SetAttributes(fullPath, FileAttributes.Normal);
                    File.SetLastWriteTime(fullPath, tridionLocalDate);
                    WriteSuccessLog(fullPath + " - Saved to Visual Studio");
                }
                else
                {
                    ProjectDestinationDialogWindow dialog = new ProjectDestinationDialogWindow();
                    dialog.Mapping = mapping;
                    dialog.TridionRole = folder.TridionRole;
                    dialog.TridionTcmId = item.TcmId;
                    dialog.TridionTitle = item.Title;
                    dialog.TridionContent = tridionItem.Content;

                    bool res = dialog.ShowDialog() == true;
                    if (res)
                    {
                        ProjectFolderInfo projectFolder = dialog.ProjectFolder;
                        ProjectFileInfo projectFile = dialog.ProjectFile;

                        if (projectFolder != null && projectFile != null)
                        {
                            string fullPath = projectFile.FullPath;
                            DateTime tridionDate = (DateTime)tridionItem.VersionInfo.RevisionDate;
                            DateTime tridionLocalDate = tridionDate.GetLocalTime(mapping.TimeZoneId);
                            SaveVSItem(fullPath, tridionItem.Content);
                            File.SetAttributes(fullPath, FileAttributes.Normal);
                            File.SetLastWriteTime(fullPath, tridionLocalDate);
                            WriteSuccessLog(fullPath + " - Saved to Visual Studio");
                        }
                    }
                }

                ShowMessage(String.Empty);
            }

            if (folder.TridionRole == TridionRole.MultimediaComponentContainer)
            {
                ComponentData tridionItem = GetComponent(mapping, item.TcmId);
                if (tridionItem == null || tridionItem.VersionInfo.RevisionDate == null)
                    return;

                ShowMessage(item.Title + "...");

                if (ProjectDestination_Skip)
                {
                    ProjectFolderInfo projectFolder = mapping.ProjectFolders.FirstOrDefault(x => x.ProjectFolderRole == ProjectFolderRole.Binary) ?? new ProjectFolderInfo();
                    if (projectFolder.ChildItems == null)
                        projectFolder.ChildItems = new List<ProjectItemInfo>();

                    string path = Path.Combine(projectFolder.Path, item.Title);

                    ProjectFileInfo projectFile = projectFolder.ChildItems.OfType<ProjectFileInfo>().FirstOrDefault(x => x.Path == path) ?? new ProjectFileInfo();
                    projectFile.Parent = projectFolder;
                    projectFile.RootPath = projectFolder.RootPath;
                    projectFile.Path = path;
                    projectFile.TcmId = item.TcmId;
                    projectFile.Checked = true;

                    if (projectFolder.ChildItems.OfType<ProjectFileInfo>().All(x => x.Path != path))
                    {
                        projectFolder.ChildItems.Add(projectFile);
                    }

                    string fullPath = projectFile.FullPath;
                    DateTime tridionDate = (DateTime)tridionItem.VersionInfo.RevisionDate;
                    DateTime tridionLocalDate = tridionDate.GetLocalTime(mapping.TimeZoneId);
                    SaveVSBinaryItem(mapping, projectFile.TcmId, fullPath);
                    File.SetAttributes(fullPath, FileAttributes.Normal);
                    File.SetLastWriteTime(fullPath, tridionLocalDate);
                    WriteSuccessLog(fullPath + " - Saved to Visual Studio");
                }
                else
                {
                    ProjectBinaryDestinationDialogWindow dialog = new ProjectBinaryDestinationDialogWindow();
                    dialog.Mapping = mapping;
                    dialog.TridionTcmId = item.TcmId;
                    dialog.TridionTitle = item.Title;

                    bool res = dialog.ShowDialog() == true;
                    if (res)
                    {
                        ProjectFolderInfo projectFolder = dialog.ProjectFolder;
                        ProjectFileInfo projectFile = dialog.ProjectFile;

                        if (projectFolder != null && projectFile != null)
                        {
                            string fullPath = projectFile.FullPath;
                            DateTime tridionDate = (DateTime)tridionItem.VersionInfo.RevisionDate;
                            DateTime tridionLocalDate = tridionDate.GetLocalTime(mapping.TimeZoneId);
                            SaveVSBinaryItem(mapping, projectFile.TcmId, fullPath);
                            File.SetAttributes(fullPath, FileAttributes.Normal);
                            File.SetLastWriteTime(fullPath, tridionLocalDate);
                            WriteSuccessLog(fullPath + " - Saved to Visual Studio");
                        }
                    }
                }

                ShowMessage(String.Empty);
            }
        }
        public static void ProcessTridionItem(MappingInfo mapping, ItemInfo item, TridionFolderInfo folder)
        {
            //todo: nested path

            if (item == null || folder == null)
                return;

            if (!folder.ScanForItems)
                return;

            if (mapping.ProjectFolders.Any(projectFolder => projectFolder.ExistsTcmId(item.TcmId)))
                return;

            if (folder.TridionRole == TridionRole.PageLayoutContainer || folder.TridionRole == TridionRole.ComponentLayoutContainer)
            {
                TemplateBuildingBlockData tridionItem = ReadItem(mapping, item.TcmId) as TemplateBuildingBlockData;
                if (tridionItem == null || tridionItem.VersionInfo.RevisionDate == null)
                    return;

                ShowMessage(item.Title + "...");

                ProjectDestinationDialogWindow dialog = new ProjectDestinationDialogWindow();
                dialog.Mapping = mapping;
                dialog.TridionRole = folder.TridionRole;
                dialog.TridionTcmId = item.TcmId;
                dialog.TridionTitle = item.Title;
                dialog.TridionContent = tridionItem.Content;

                bool res = dialog.ShowDialog() == true;
                if (res)
                {
                    ProjectFolderInfo projectFolder = dialog.ProjectFolder;
                    ProjectFileInfo projectFile = dialog.ProjectFile;

                    if (projectFolder != null && projectFile != null)
                    {
                        string path = projectFile.FullPath;
                        DateTime tridionDate = (DateTime) tridionItem.VersionInfo.RevisionDate;
                        DateTime tridionLocalDate = tridionDate.GetLocalTime(mapping.TimeZoneId);
                        SaveVSItem(path, tridionItem.Content);
                        File.SetAttributes(path, FileAttributes.Normal);
                        File.SetLastWriteTime(path, tridionLocalDate);
                        WriteSuccessLog(path + " - Saved to Visual Studio");
                    }
                }

                ShowMessage(String.Empty);
            }

            if (folder.TridionRole == TridionRole.MultimediaComponentContainer)
            {
                ComponentData tridionItem = GetComponent(mapping, item.TcmId);
                if (tridionItem == null || tridionItem.VersionInfo.RevisionDate == null)
                    return;

                ShowMessage(item.Title + "...");

                ProjectBinaryDestinationDialogWindow dialog = new ProjectBinaryDestinationDialogWindow();
                dialog.Mapping = mapping;
                dialog.TridionTcmId = item.TcmId;
                dialog.TridionTitle = item.Title;

                bool res = dialog.ShowDialog() == true;
                if (res)
                {
                    ProjectFolderInfo projectFolder = dialog.ProjectFolder;
                    ProjectFileInfo projectFile = dialog.ProjectFile;

                    if (projectFolder != null && projectFile != null)
                    {
                        string path = projectFile.FullPath;
                        DateTime tridionDate = (DateTime)tridionItem.VersionInfo.RevisionDate;
                        DateTime tridionLocalDate = tridionDate.GetLocalTime(mapping.TimeZoneId);
                        SaveVSBinaryItem(mapping, projectFile.TcmId, path);
                        File.SetAttributes(path, FileAttributes.Normal);
                        File.SetLastWriteTime(path, tridionLocalDate);
                        WriteSuccessLog(path + " - Saved to Visual Studio successfully");
                    }
                }

                ShowMessage(String.Empty);
            }
        }