protected function executeCommand(CommandInterface $command)
    {
        try {
            return $command->execute();
        }catch (ServerErrorResponseException $ex){
            throw new ApiException($ex->getResponse()->getBody(true), $ex->getResponse()->getStatusCode(), $ex);
        }catch (ClientErrorResponseException $ex) {
            if($ex->getResponse()->getStatusCode() == '401'){
                throw new UnauthorizedException($ex->getResponse()->getBody(true), $ex->getResponse()->getStatusCode(), $ex);
            }
            throw new ApiException($ex->getResponse()->getBody(true), $ex->getResponse()->getStatusCode(), $ex);
        }catch (BadResponseException $ex) {
            throw new ApiException($ex->getResponse()->getBody(), $ex->getResponse()->getStatusCode(), $ex);
        }catch (CurlException $ex) {
            throw new ServerDownException($ex->getMessage(), $ex->getCode(), $ex);
        }catch (Exception $ex){
            throw new ApiException($ex->getMessage(), $ex->getCode(), $ex);
        }
    }