private static IIssueDecisionViewModel Create(DuplicateFilesIssue duplicateFilesIssue, IPhotoDirectory photoDirectory)
        {
            IEnumerable <Checkable <FileInformation> > filesToKeep;

            if (duplicateFilesIssue.File.RelativeFilename != null)
            {
                // just keep one file, try to find the file that is located correctly
                var bestFile = duplicateFilesIssue.RelevantFiles.FirstOrDefault(x =>
                                                                                x.RelativeFilename != null && Regex.IsMatch(x.RelativeFilename, photoDirectory.GetFilenameTemplate(x).ToRegexPattern())) ??
                               duplicateFilesIssue.File;

                filesToKeep = new[] { duplicateFilesIssue.File }.Concat(duplicateFilesIssue.RelevantFiles)
                .Select(x => new Checkable <FileInformation>(x, x == bestFile));
            }
            else
            {
                // in case of import, we just delete the file that would be imported
                filesToKeep = new[] { new Checkable <FileInformation>(duplicateFilesIssue.File) }.Concat(
                    duplicateFilesIssue.RelevantFiles.Select(x => new Checkable <FileInformation>(x, true)));
            }

            return(new DuplicateFileDecisionViewModel(duplicateFilesIssue, filesToKeep.ToList()));
        }
 public DuplicateFileDecisionViewModel(DuplicateFilesIssue fileIssue, IReadOnlyList <Checkable <FileInformation> > files) : base(fileIssue, files)
 {
     Issue = fileIssue;
 }