public Task Add(IList <IClientSpan> spans) { if (spans == null || spans.Count == 0) { return(0.AsTask()); } var entities = new List <ClientSpanEntity>(); foreach (var span in spans) { var spanEntity = new ClientSpanEntity(); MyModelHelper.SetProperties(spanEntity, span); entities.Add(spanEntity); } var jsonLine = entities.ToJson(false); var now = spans.Min(x => x.StartUtc); var archive = DateTimeRangeArchive.Create(now); var filePath = CreateFilePath(archive.ArchiveId); return(_asyncFile.AppendAllText(filePath, jsonLine, true)); }