public int StoreSnapshot( IReadOnlyCollection <Blob> blobs, Fuzzy scanFuzzy, DateTime creationTimeUtc, Func <string, Stream> openRead) { var newSnapshot = new Snapshot( _currentSnapshotId == null ? 0 : _currentSnapshotId.Value + 1, creationTimeUtc, WriteBlobs(blobs, scanFuzzy, openRead)); using var memoryStream = new MemoryStream( DataConvert.ObjectToBytes(newSnapshot)); var newSnapshotReference = new SnapshotReference( _salt, _iterations, WriteContent(AesGcmCrypto.GenerateNonce(), memoryStream)); _intRepository.StoreValue( newSnapshot.SnapshotId, DataConvert.ObjectToBytes(newSnapshotReference)); _currentSnapshotId = newSnapshot.SnapshotId; _probe.StoredSnapshot(newSnapshot.SnapshotId); return(newSnapshot.SnapshotId); }