// Take the collection of samples the user gave us, and convert them into the underlying format.
        private void StoreTwo()
        {
            List <OtherItemDataCsvItem> rawSamples = new List <OtherItemDataCsvItem>();

            double currentSamplingInterval = SamplingInterval;

            double lastOffset = -SamplingInterval;

            for (int sampleNumber = 0; sampleNumber < _twoValuedSamples.Count; sampleNumber++)
            {
                ExerciseSampleTwoValue sample = _twoValuedSamples[sampleNumber];

                // Is this sample coming when it's expected?
                // if not, we need to put in an escape...
                if (lastOffset + currentSamplingInterval != sample.OffsetInSeconds)
                {
                    currentSamplingInterval = sample.OffsetInSeconds - lastOffset;

                    OtherItemDataCsvEscape escape = new OtherItemDataCsvEscape("i", currentSamplingInterval.ToString());
                    rawSamples.Add(escape);
                }

                rawSamples.Add(new OtherItemDataCsvDouble(sample.Value1));
                rawSamples.Add(new OtherItemDataCsvDouble(sample.Value2));
                lastOffset = sample.OffsetInSeconds;
            }

            SetOtherData(rawSamples);
        }
        // Get all the samples as doubles, and create the collection that we want to return to the user.
        // We set the time offset from the initial sampling interval and any escapes that are present to
        // reset it.
        private void CreateSingleValuedSamples()
        {
            ProcessCompressedAndEncodedData();

            _singleValuedSamples = new Collection <ExerciseSampleOneValue>();

            Collection <OtherItemDataCsvItem> rawSamples = GetAsDouble();

            double currentSampleInterval = _samplingInterval;
            double offsetInSeconds       = -currentSampleInterval;

            for (int sampleIndex = 0; sampleIndex < rawSamples.Count; sampleIndex++)
            {
                OtherItemDataCsvItem item = rawSamples[sampleIndex];

                OtherItemDataCsvDouble itemDouble = item as OtherItemDataCsvDouble;

                if (itemDouble != null)
                {
                    offsetInSeconds += currentSampleInterval;

                    ExerciseSampleOneValue sample = new ExerciseSampleOneValue(offsetInSeconds, itemDouble.Value);
                    _singleValuedSamples.Add(sample);
                }

                OtherItemDataCsvEscape itemEscape = item as OtherItemDataCsvEscape;
                if (itemEscape != null)
                {
                    if (itemEscape.Name == "i")
                    {
                        currentSampleInterval = double.Parse(itemEscape.Value);
                    }
                }
            }
        }