public static IEnumerable <BusRoute> GetRoutes(BusContext db)
        {
            var queryResult = from r in db.BusRoutes
                              select BusRoute.FromMemento(r);

            return(queryResult.AsEnumerable());
        }
        public static void ScheduleBus(BusContext db, string busNumber, string routeName)
        {
            //pretend this is in a repository
            var bus   = Bus.FromMemento(db.Buses.Single(b => b.BusNumber == busNumber));
            var route = BusRoute.FromMemento(db.BusRoutes.Single(r => r.Id == int.Parse(routeName)));

            var schedule = new ScheduledService(new ScheduledServiceId(Guid.NewGuid()), bus.Id, route.Id);

            if (busNumber.StartsWith("A"))
            {
                schedule.Activate();
            }

            db.Services.Add(schedule.State);
            db.SaveChanges();
        }