public static MarcellDocument ToDocument(this LuceneDocument source) { MarcellDocument result = new MarcellDocument { Id = source.GetValues("Id")?.FirstOrDefault(), InternalId = Guid.Parse(source.GetValues("InternalId").First()), ApprovalDate = source.GetDate("ApprovalDate"), DocumentDate = source.GetDate("DocumentDate"), EffectiveDate = source.GetDate("EffectiveDate"), DocumentSimilarityData = new SimilarityData { ConsolidatedTokens = source.GetStringList("DocumentToken"), ConsolidatedTopics = source.GetStringList("DocumentTopic"), }, TokenCount = source.GetInt("TokenCount"), DocumentType = source.GetValues("DocumentType")?.FirstOrDefault(), OriginalType = source.GetValues("OriginalType")?.FirstOrDefault(), Issuer = source.GetValues("Issuer")?.FirstOrDefault(), Language = source.GetValues("Language")?.FirstOrDefault(), Url = source.GetValues("Url")?.FirstOrDefault(), RecognitionQuality = source.GetDouble("RecognitionQuality"), IsStructured = source.GetBool("IsStructured"), FileName = source.GetValues("FileName")?.FirstOrDefault(), }; return(result); }