public function callApiFunction($apiFunction, array $message, Result $result = null)
    {
        if ($result === null) {
            $result = $this->container->getResult();
        }
        $uri = $this->getUri($apiFunction);

        try {
            $commonMessagePart = $this->getCommonPart();
            $message = array_merge($commonMessagePart, $message);

            // Send message, receive response.
            $result = $this->sendApiMessage($uri, $message, $result);
        } catch (RuntimeException $e) {
            $result->setException($e);
        }

        $this->log->debug('Communicator::callApiFunction() uri=%s; %s', $uri, $result->toLogString());
        return $result;
    }