private function getClosestUploadEndpoint()
    {
        if (isset($this->awsBucket)) {
            return new Promise\FulfilledPromise($this->awsBucket);
        } else {
            return $this->requestHandler->sendRequestAsync('GET', 'api/upload/endpoint')
                ->then(
                    function ($result) {
                        $this->awsBucket = $result;
                        return $result;
                    });
        }
    }