public function generateScheduler($scheduler)
    {
        if (count($this->scheduler)) {
            return $this->scheduler;
        }

        $history = Scheduler::where('scheduler_id', $scheduler->id)->get()->groupBy(function($item) {
            return $item->created_at->format('Y-m-d');
        })->map(function ($row) {
            return round($row->avg('time_to_run'), 2);
        });

        // Fill the array gaps - because the chart wont populate correctly without 0 values
        for($i=20; $i>=0; $i--) {
            $this->scheduler['day'][] = Carbon::now($scheduler->timezone)->subDay($i)->format('d');

            if (isset($history[Carbon::now($scheduler->timezone)->subDay($i)->format('Y-m-d')])) {
                $this->scheduler['count'][] = $history[Carbon::now($scheduler->timezone)->subDay($i)->format('Y-m-d')];
            } else {
                $this->scheduler['count'][] = 0;
            }
        }

        return $this->scheduler;
    }