public static Task <IList <TrackInformation> > GetCollectedTracks(TimeOrdering ordering)
        {
            return(Task.Run <IList <TrackInformation> >(() => {
                using (var db = DatabaseUtility.OpenConnection()) {
                    var records = db.GetTracks(ordering);

                    return (from r in records
                            select new TrackInformation(
                                r.TrackId,
                                r.Start,
                                r.ElapsedTime,
                                r.DistanceTraveled
                                )).ToList();
                }
            }));
        }
 private static string GetSql(TimeOrdering ordering)
 {
     return((ordering == TimeOrdering.OldFirst) ? "ASC" : "DESC");
 }
 public static IList <StatisticRecord> GetTracks(this SQLiteConnection c, TimeOrdering ordering = TimeOrdering.OldFirst)
 {
     return(c.Query <StatisticRecord>(
                $"SELECT * FROM StatisticRecord ORDER BY StatisticRecord.Start {GetSql(ordering)}"
                ));
 }