public static Snapshot ToSnapshot(this JSnapshot jSnapshot) { if (jSnapshot == null) { throw new ArgumentNullException(nameof(jSnapshot)); } Snapshot snapshot = new() { Id = jSnapshot.Id, OriginalPath = jSnapshot.OriginalPath, CreationTime = jSnapshot.CreationTime }; IEnumerable <HDirectory> directories = jSnapshot.GetHDirectories(); if (directories != null) { snapshot.Directories.AddRange(directories); } IEnumerable <HFile> files = jSnapshot.GetHFiles(); if (files != null) { snapshot.Files.AddRange(files); } return(snapshot); }