public MyListItem addFileToList(MyTreeNode versionNode)
        {
            // In case of Fusion files we'll be downloading f3z
            var postFix = versionNode.isFusionFile() ? ".f3z" : "." + versionNode.fileType;

            // Get relative folder path that we need to recreate on the
            // local storage side
            var        relPath = "";
            MyTreeNode node    = versionNode;

            do
            {
                node    = (MyTreeNode)node.Parent;
                relPath = "\\" + removeIllegalFilenameCharacters(node.Text) + relPath;
            } while (nodeToDownload != node);
            relPath = relPath.Replace(new string(kUpdateChar, 1), "");

            // Add file extrension if needed
            if (postFix != "." && !relPath.EndsWith(postFix) && !relPath.EndsWith(postFix.ToUpper()))
            {
                relPath += postFix;
            }

            // Create list item
            var          item   = new MyListItem(versionNode, tbxBackupFolder.Text + relPath);
            ListViewItem lvItem = ltvFiles.Items.Add(item);

            lvItem.SubItems.Add(item.fileState.ToString());

            return(item);
        }
        private async void startDownload(MyTreeNode node, MyListItem item)
        {
            if (item == null)
            {
                item = addFileToList(node);
            }

            try
            {
                setItemState(item, DownloadState.Downloading);

                var versionsApi = new VersionsApi();
                versionsApi.Configuration.AccessToken = logInInfo.accessToken;

                string[] idParams  = node.id.Split('/');
                string   versionId = HttpUtility.UrlDecode(idParams[idParams.Length - 1]);
                string   projectId = idParams[idParams.Length - 3];

                dynamic version = null;
                while (version == null)
                {
                    try
                    {
                        version = await versionsApi.GetVersionAsync(projectId, versionId);
                    }
                    catch (Exception ex)
                    {
                        Debug.Print("startDownload >> catch1 : " + ex.Message);
                        await Task.Delay(kTimeOutDelay);
                    }
                }

                string href = null;

                // Is it a Fusion Design or Drawing?
                if (node.isFusionFile())
                {
                    // Request f3z
                    setItemState(item, DownloadState.Waiting);
                    href = await getF3z(projectId, versionId);

                    setItemState(item, DownloadState.Downloading);
                }
                else
                {
                    try
                    {
                        href = version.data.relationships.storage.meta.link.href;
                    }
                    catch (Exception ex)
                    {
                        Debug.Print("startDownload >> catch2 : " + ex.Message);
                    }
                }

                if (href == null)
                {
                    throw new Exception("Download failed");
                }

                Debug.Print("startDownload : Before calling downloadFile");
                await downloadFile(item.localPath, href);

                Debug.Print("startDownload : After calling downloadFile");

                setItemState(item, DownloadState.Downloaded);
            }
            catch (Exception ex)
            {
                Debug.Print("startDownload >> catch : " + ex.Message);
                setItemState(item, DownloadState.Failed);
            }
        }