/// <summary>
        /// Gets collection of inbound SMS messages sent to some short code.
        /// </summary>
        /// <param name="shortCode">Short code.</param>
        /// <exception cref="System.ArgumentNullException">shortCode is null.</exception>
        public async Task <IEnumerable <InboundSms> > GetInboundSmsMessages(string shortCode)
        {
            Argument.ExpectNotNullOrWhiteSpace(() => shortCode);

            var result       = new List <InboundSms>();
            int messagesLeft = 1;

            // Call get SMS messages until there are no messages left on the server.
            while (messagesLeft > 0)
            {
                InboundSmsMessageList messages = await _smsServiceWrapper.GetInboundSmsMessages(shortCode);

                result.AddRange(
                    messages.InboundSmsMessage
                    .Select(m => new InboundSms(
                                m.MessageId,
                                new PhoneNumber(m.SenderAddress),
                                m.Message)).ToList <InboundSms>()
                    );
                messagesLeft = messages.TotalNumberOfPendingMessages;
            }

            await Task.Delay(GetSmsPollPeriodMilliseconds);

            return(result);
        }
    /// <summary>
    /// This function calls receive sms api to fetch the sms's
    /// </summary>
    private void RecieveSms()
    {
        InboundSmsMessageList message = this.requestFactory.ReceiveSms(this.shortCode);

        Table table = new Table();

        table.Font.Name   = "Sans-serif";
        table.Font.Size   = 9;
        table.BorderStyle = BorderStyle.Outset;
        table.Width       = Unit.Pixel(650);
        TableRow  tableRow  = new TableRow();
        TableCell tableCell = new TableCell();

        tableCell.Width     = Unit.Pixel(110);
        tableCell.Text      = "SUCCESS:";
        tableCell.Font.Bold = true;
        tableRow.Cells.Add(tableCell);
        table.Rows.Add(tableRow);
        tableRow            = new TableRow();
        tableCell           = new TableCell();
        tableCell.Width     = Unit.Pixel(150);
        tableCell.Text      = "Messages in this batch:";
        tableCell.Font.Bold = true;
        tableRow.Cells.Add(tableCell);
        tableCell = new TableCell();
        tableCell.HorizontalAlign = HorizontalAlign.Left;
        tableCell.Text            = message.NumberOfMessagesInThisBatch.ToString();
        tableRow.Cells.Add(tableCell);
        table.Rows.Add(tableRow);
        tableRow            = new TableRow();
        tableCell           = new TableCell();
        tableCell.Width     = Unit.Pixel(110);
        tableCell.Text      = "Messages pending:";
        tableCell.Font.Bold = true;
        tableRow.Cells.Add(tableCell);
        tableCell      = new TableCell();
        tableCell.Text = message.TotalNumberOfPendingMessages.ToString();
        tableRow.Cells.Add(tableCell);
        table.Rows.Add(tableRow);
        tableRow = new TableRow();
        table.Rows.Add(tableRow);
        tableRow = new TableRow();
        table.Rows.Add(tableRow);
        Table secondTable = new Table();

        if (message.NumberOfMessagesInThisBatch > 0)
        {
            tableRow = new TableRow();
            secondTable.Font.Name     = "Sans-serif";
            secondTable.Font.Size     = 9;
            tableCell                 = new TableCell();
            tableCell.Width           = Unit.Pixel(100);
            tableCell.Text            = "Message Index";
            tableCell.HorizontalAlign = HorizontalAlign.Center;
            tableCell.Font.Bold       = true;
            tableRow.Cells.Add(tableCell);
            tableCell                 = new TableCell();
            tableCell.Font.Bold       = true;
            tableCell.Width           = Unit.Pixel(350);
            tableCell.Wrap            = true;
            tableCell.Text            = "Message Text";
            tableCell.HorizontalAlign = HorizontalAlign.Center;
            tableRow.Cells.Add(tableCell);
            tableCell                 = new TableCell();
            tableCell.Text            = "Sender Address";
            tableCell.HorizontalAlign = HorizontalAlign.Center;
            tableCell.Font.Bold       = true;
            tableCell.Width           = Unit.Pixel(175);
            tableRow.Cells.Add(tableCell);
            secondTable.Rows.Add(tableRow);

            foreach (InboundSmsMessage prime in message.InboundSmsMessage)
            {
                tableRow = new TableRow();
                TableCell tableCellmessageId = new TableCell();
                tableCellmessageId.Width           = Unit.Pixel(75);
                tableCellmessageId.Text            = prime.MessageId.ToString();
                tableCellmessageId.HorizontalAlign = HorizontalAlign.Center;
                TableCell tableCellmessage = new TableCell();
                tableCellmessage.Width           = Unit.Pixel(350);
                tableCellmessage.Wrap            = true;
                tableCellmessage.Text            = prime.Message.ToString();
                tableCellmessage.HorizontalAlign = HorizontalAlign.Center;
                TableCell tableCellsenderAddress = new TableCell();
                tableCellsenderAddress.Width           = Unit.Pixel(175);
                tableCellsenderAddress.Text            = prime.SenderAddress.ToString();
                tableCellsenderAddress.HorizontalAlign = HorizontalAlign.Center;
                tableRow.Cells.Add(tableCellmessageId);
                tableRow.Cells.Add(tableCellmessage);
                tableRow.Cells.Add(tableCellsenderAddress);
                secondTable.Rows.Add(tableRow);
            }
        }

        table.BorderColor = Color.DarkGreen;
        table.BackColor   = System.Drawing.ColorTranslator.FromHtml("#cfc");
        table.BorderWidth = 2;

        getMessagePanel.Controls.Add(table);
        getMessagePanel.Controls.Add(secondTable);
    }