public function validate(string $api_session = null)
    {
        $this->details = false;
        if (empty($api_session) === false && is_string($api_session) === true) {
            $session = Model\Session::with('user')->where('code', $api_session)->first();
            if ($session !== null) {
                if (strtotime($session->updated_at) < strtotime("-1 hour") || $session->user === null) {
                    $this->invalidate($api_session);
                } else {
                    $session->updated_at = date('Y-m-d H:i:s');
                    $session->save();
                    $this->details = $session->user;
                }
            } else {
                $_SESSION['api_session'] = null;
            }
        }
    }