public StatusEndpoint(Scheduler scheduler, SchedulerDatabase db)
            : base("/status")
        {
            Get["/"] = _ =>
                new StatusModel
                {
                    State = scheduler.State
                };

            Put["/"] = _ =>
            {
                var status = this.Bind<StatusModel>();

                if (status.State == SystemState.ClearData)
                {
                    db.ClearAll();
                }
                else if (scheduler.State != status.State)
                {
                    Console.WriteLine("System status set to {0}", status.State);
                    scheduler.State = status.State;
                }

                return new StatusModel
                {
                    UserKey = Program.UserKey,
                    State = scheduler.State
                };
            };
        }
        public StatusEndpoint(SchedulerDatabase db)
            : base("/status")
        {
            _db = db;

            Get["/"] = _ =>
                new StatusModel
                {
                    StartupKey = Program.StartupKey,
                    State = SystemState.Ready
                };

            Put["/"] = _ =>
            {
                var status = this.Bind<StatusModel>();
                if (status.State == SystemState.Reset)
                {
                    _db.ClearAll();
                }
                return new StatusModel
                {
                    StartupKey = Program.StartupKey,
                    State = SystemState.Ready
                };
            };
        }