anchor.diff:      member val RecordsAvailable = Unchecked.defaultof<int> with get, set
       member val ThreadCount = Unchecked.defaultof<int> with get, set
   
  +type TargetRecord(sessionId, sourceId) = 
  +    member val TargetId = 0 with get, set
  +    member val TargetRecordId = "" with get, set
  +    member val TargetDisplayName = "" with get, set
  +    member val TrueDuplicate = false with get, set
  +    member val Quality = "0" with get, set
  +    member val TargetScore = 0.0f with get, set
  +
   type SourceRecord(sessionId) = 
       member val SessionId = sessionId
  -    member val SourceId = Guid.NewGuid().ToString()
  +    member val SourceId = 0 with get, set
       member val SourceRecordId = "" with get, set
       member val SourceDisplayName = "" with get, set
       member val SourceStatus = "0" with get, set
       member val TotalDupes = 0 with get, set
  -
  -type TargetRecord(sessionId, sourceId) = 
  -    member val TargetId = Guid.NewGuid().ToString()
  -    member val TargetRecordId = "" with get, set
  -    member val TargetDisplayName = "" with get, set
  -    member val Quality = "0" with get, set
  -    member val TargetScore = 0.0f with get, set
  +    member val TargetRecords = new List<TargetRecord>() with get, set
   
   type DuplicateDetectionRequest() = 
       inherit DtoBase()
  
positive.code:         | Choice1Of2(results) -> 
              if results.Meta.RecordsReturned > 1 then 
                  !>"Duplicate Found"
                  let targetRecords = new List<TargetRecord>()
                  let header = 
                      new SourceRecord(session.SessionId, SourceRecordId = record.[Constants.IdField], 
                                       SourceDisplayName = record.[session.DisplayFieldName])
                  let docs = results |> toFlatResults
                  for result in docs.Documents do
                      let resultScore = float32 result.[Constants.Score]
                      if not (result.[Constants.IdField] = header.SourceRecordId) then 
                          let score = docs.Meta.BestScore / resultScore * 100.0f
                          let targetRecord = 
                              new TargetRecord(session.SessionId, header.SourceId, 
                                               TargetDisplayName = result.[session.DisplayFieldName], 
                                               TargetScore = score,
                                               TargetRecordId = result.[Constants.IdField])
                          targetRecords.Add(targetRecord)
                  if targetRecords.Count >= 1 then writeDuplicates (header, targetRecords, documentService)
          | _ -> ()
      
      let performDuplicateDetection (jobId, indexWriter : IndexWriter.T, req : DuplicateDetectionRequest) = 
  
negative.code:         doc.Fields.Add(sessionProperties, formatter.SerializeToString(session))
          documentService.AddOrUpdateDocument(doc) |> ignore
      
      let writeDuplicates (sourceRecord : SourceRecord, documentService : IDocumentService) = 
          let sourceDoc = new Document.Dto(schema.IndexName, getId())
          sourceDoc.Fields.Add(sessionId, sourceRecord.SessionId)
          sourceDoc.Fields.Add(sourceId, sourceRecord.SourceId.ToString())
          sourceDoc.Fields.Add(sourceRecordId, sourceRecord.SourceRecordId)
          sourceDoc.Fields.Add(sourceDisplayName, sourceRecord.SourceDisplayName)
          sourceDoc.Fields.Add(sourceStatus, sourceRecord.SourceStatus)
          sourceDoc.Fields.Add(totalDupesFound, sourceRecord.TargetRecords.Count.ToString())
          sourceDoc.Fields.Add(recordType, sourceRecordType)
          sourceDoc.Fields.Add(targetRecords, formatter.SerializeToString(sourceRecord.TargetRecords))
          documentService.AddDocument(sourceDoc) |> ignore
          
  [<Sealed>]
  [<Name("POST-/indices/:id/duplicatedetection/:id")>]
  type DuplicateDetectionHandler(indexService : IIndexService, documentService : IDocumentService, searchService : ISearchService) = 
  