private void WriteFetchExecutionRange(FetchExecutionRange fetchExecutionRange)
        {
            this.WriteBeforeFetchExecutionRange();

            this.WriteFetchPartitionKeyRangeId(fetchExecutionRange.PartitionId);
            this.WriteActivityId(fetchExecutionRange.ActivityId);
            this.WriteStartTime(fetchExecutionRange.StartTime);
            this.WriteEndTime(fetchExecutionRange.EndTime);
            this.WriteFetchDocumentCount(fetchExecutionRange.NumberOfDocuments);
            this.WriteFetchRetryCount(fetchExecutionRange.RetryCount);

            this.WriteAfterFetchExecutionRange();
        }
 /// <summary>
 /// Updates the most recent end time internally and constructs a new FetchExecutionRange
 /// </summary>
 /// <param name="numberOfDocuments">The number of documents that were fetched for this range.</param>
 /// <param name="retryCount">The number of times we retried for this fetch execution range.</param>
 public void EndFetchRange(long numberOfDocuments, long retryCount)
 {
     if (this.isFetching)
     {
         // Calculating the end time as the construction time and the stopwatch as a delta.
         this.endTime = this.constructionTime.Add(this.stopwatch.Elapsed);
         FetchExecutionRange fetchExecutionRange = new FetchExecutionRange(
             this.startTime,
             this.endTime,
             this.partitionKeyRangeId,
             numberOfDocuments,
             retryCount);
         this.fetchExecutionRanges.Add(fetchExecutionRange);
         this.isFetching = false;
     }
 }