private function sendMessage($receiver, $message)
    {
        $id = null;

        switch ($message->type)
        {
            case 'text':
                $id = $this->broadcast
                        ? $this->gateway()->sendBroadcastMessage($receiver, $message->message)
                        : $this->gateway()->sendMessage($receiver, $message->message);
                break;
            case 'image':
                $id = $this->broadcast
                        ? $this->gateway()->sendBroadcastImage($receiver, $message->file, false, $message->filesize, $message->hash, $message->caption)
                        : $this->gateway()->sendMessageImage($receiver, $message->file, false, $message->filesize, $message->hash, $message->caption);
                break;
            case 'audio':
                $id = $this->broadcast
                        ? $this->gateway()->sendBroadcastAudio($receiver, $message->file, false, $message->filesize, $message->hash)
                        : $this->gateway()->sendMessageAudio($receiver, $message->file, false, $message->filesize, $message->hash);
                break;
            case 'video':
                $id = $this->broadcast
                        ? $this->gateway()->sendBroadcastVideo($receiver, $message->file, false, $message->filesize, $message->hash, $message->caption)
                        : $this->gateway()->sendMessageVideo($receiver, $message->file, false, $message->filesize, $message->hash, $message->caption);
                break;
            case 'location':
                $id = $this->broadcast 
                        ? $this->gateway()->sendBroadcastLocation($receiver, $message->longitude, $message->latitude, $message->caption, $message->url)
                        : $this->gateway()->sendMessageLocation($receiver, $message->longitude, $message->latitude, $message->caption, $message->url);
                break;
            case 'vcard':
                $id = $this->broadcast 
                        ? $this->gateway()->sendBroadcastVcard($receiver, $message->name, $message->vcard->show())
                        : $this->gateway()->sendVcard($receiver, $message->name, $message->vcard->show());
                break;
            default:
                            
            break;
        }

        while ($this->gateway()->pollMessage());

        return $id;
    }