public static void AddLogToCollection(string jsonDocument,string collectionName)
        {
            try
            {
                var document = BsonDocument.Parse(jsonDocument);

                document = CorrectDateField(document);

                var keyValue = document.First().Value.ToString();

                var result = new BsonDocument();
                result.Add("_id", keyValue);

                var mongoRepo = new MongoDBRepository<MongoDBContext>();
                var fResult = mongoRepo.FinObjectByKey(collectionName, keyValue).ToList();

                if (fResult != null && fResult.Count == 1)
                {
                    var value = fResult.First().Last().Value as BsonArray;
                    if (value != null)
                    {
                        var doc = fResult.First().Last().Value as BsonArray;
                        doc.Add(document.Last().Value);
                        CopyMidelElmentInResult(document, result);
                        result.Add(document.Last().Name, doc);
                        mongoRepo.ReplaceOne(keyValue, collectionName, result);
                    }
                    else
                    {
                        var doc = fResult.First().Last().Value as BsonDocument;
                        var list = new BsonArray();
                        list.Add(doc);
                        list.Add(document.Last().Value);
                        CopyMidelElmentInResult(document, result);
                        result.Add(doc.Last().Name, list);
                        mongoRepo.ReplaceOne(keyValue, collectionName, result);
                    }
                }
                else
                {

                    CopyMidelElmentInResult(document, result);
                    var list = new BsonArray();
                    list.Add(document.Last().Value);
                    result.Add(document.Last().Name, list);
                    mongoRepo.AddOne(collectionName, result);
                }

            }
            catch(Exception ex)
            {
                APILogger.Write(ex.Message, LogLevel.Error);
            }
           
        }