public static EntityModel Load(string title, LocateResult result)
 {
     var root = new FolderModel(title);
     foreach (TorrentFileLink file in result.TorrentFileLinks)
     {
         var folder = FindOrCreateFolder(root, file.TorrentFile.Path);
         var fileModel = new FileModel(file.TorrentFile);
         fileModel.Located = file.State == LinkState.Located;
         folder.Entities.Add(fileModel);
     }
     return root;
 }
        private void AnalyseFinish(IAsyncResult ar)
        {
            var func = ar.AsyncState as Func<LocateResult>;
            try
            {
                LocateResult result = func.EndInvoke(ar);

                this.UpdateStatusFormat("Successfully located {0} of {1} file(s). Matched {2} of {3} file(s) on disk.",
                    result.LocatedCount,
                    result.LocatedCount + result.UnlocatedCount,
                    result.TorrentFileLinks.Where(c => c.State == LinkState.Located)
                        .Where(c => c.LinkedFsFileInfo != null)
                        .Select(c => c.LinkedFsFileInfo.FilePath)
                        .Distinct()
                        .Count(), this._fileSystemFileInfos.Count);
                this._locateResult = result;

                EntityModel.Update(this._fileSystemEntityModel[0],
                    result.TorrentFileLinks.Where(c => c.State == LinkState.Located).Select(c => c.LinkedFsFileInfo));
                this.RaisePropertyChanged(() => this.FileSystemEntityModel);

                this.Set(() => this.TorrentEntityModel, ref this._torrentEntityModel,
                    new[] { EntityModel.Load(this._torrent.Name, result) });
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }