public function execute() {
        $ch = \curl_init();

        $this->setAuth($ch);
        try {
            switch (strtoupper($this->method)) {
                case 'GET':
                    $this->executeGet($ch);
                    break;
                case 'POST':
                    $this->executePost($ch);
                    break;
                case 'PUT':
                    $this->executePut($ch);
                    break;
                case 'PATCH':
                    $this->executePatch($ch);
                    break;
                case 'DELETE':
                    $this->executeDelete($ch);
                    break;
                // This custom case is used to execute a Multipart PUT request
                case 'PUT_MP':
                    $this->method = 'PUT';
                    $this->executePutMultipart($ch);
                    break;
                case 'POST_MP':
                    $this->method = 'POST';
                    $this->executePostMultipart($ch);
                    break;
                default:
                    throw new \InvalidArgumentException('Current method (' . $this->method . ') is an invalid REST method.');
            }
        } catch (\InvalidArgumentException $e) {
            \curl_close($ch);
            throw $e;
        } catch (\Exception $e) {
            \curl_close($ch);
            throw $e;
        }
    }