public function send($method, $endpoint, $data = [])
    {
        $method = strtolower($method);

        if ($method !== 'get' && $this->isUserLoggedIn()) {
            $this->generateCSRFToken();
        }

        $csfrToken = '-';

        // load csfr token from cookies
        /** @var CookieJar $cookies */
        $cookies = $this->client->getConfig()['cookies'];
        foreach($cookies->toArray() as $cookie) {
            if ($cookie['Name'] === 'CSRF_TOKEN') {
                $csfrToken = $cookie['Value'];
                break;
            }
        }

        // set auth data and post data
        $options = [
            'body' => $method === 'post' || $method === 'put' ? json_encode($data) : null,
            'headers' => [
                'Content-Type' => 'application/json',
                'Cookie' => 'CSRF_TOKEN=' . $csfrToken,
                'X-CSRF-TOKEN' => $csfrToken,
            ]
        ];

        return $this->client->$method($endpoint, $options);
    }