public static TrackSegment Create(GpxTrackSegment gpxTrackSegment)
        {
            var trackSegment = new TrackSegment();
            List <TrackPoint> trackPoints = new List <TrackPoint>();

            foreach (var point in gpxTrackSegment.TrackPoints)
            {
                trackPoints.Add(TrackPoint.Create(point));
            }
            trackSegment.TrackPoints = trackPoints;
            trackSegment.Elevation   = ElevationProcessor.SegmentElevation(trackPoints);
            trackSegment.Duration    = DurationProcessor.SegmentDuration(trackPoints);
            trackSegment.Distance    = DistanceProcessor.SegmentDistance(trackPoints);

            return(trackSegment);
        }
        public static ExerciseSession Create(GpxTrack track)
        {
            var exerciseSession = new ExerciseSession
            {
                Name = track.Name,
                Time = track.Time
            };
            ICollection <TrackSegment> trackSegments = new List <TrackSegment>();

            foreach (var gpxTrackSegment in track.Segments)
            {
                trackSegments.Add(TrackSegment.Create(gpxTrackSegment));
            }
            exerciseSession.Elevation     = ElevationProcessor.SessionElevation(trackSegments);
            exerciseSession.Duration      = DurationProcessor.SessionDuration(trackSegments);
            exerciseSession.Distance      = DistanceProcessor.SessionDistance(trackSegments);
            exerciseSession.Calories      = CaloriesProcessor.GetCaloriesBurned(exerciseSession);
            exerciseSession.Pace          = PaceProcessor.GetAveragePace(exerciseSession);
            exerciseSession.ActivityType  = ActivityProcessor.GetActivityType(exerciseSession);
            exerciseSession.Speed         = SpeedProcessor.GetAverageSpeed(exerciseSession);
            exerciseSession.TrackSegments = trackSegments;

            return(exerciseSession);
        }