public void AddRating(RatingRecord record)
        {
            if (record == null)
            {
                throw new ArgumentNullException(nameof(record));
            }

            stream.OnNext(record);
            @lock.EnterWriteLock();
            try
            {
                ratings.Add(record);
                if (idTable.ContainsKey(record.Id))
                {
                    logger.LogWarning("<{0}> key already present. Replacing", record.Id);
                    ratings.Remove(idTable[record.Id]);
                }

                idTable[record.Id] = record;
            }
            finally
            {
                @lock.ExitWriteLock();
            }
        }
 private void Process(ITracker tracker, RatingRecord record)
 {
     lock (writer)
     {
         writer.WriteField(record.Date);
         writer.WriteField(tracker.Name);
         writer.WriteField(tracker.Type);
         writer.WriteField(record.Id);
         writer.WriteField(record.Rating);
         writer.NextRecord();
         writer.Flush();
         streamWriter.Flush();
     }
 }