public SmsResponse SendSms(Sms sms)
        {
            if (sms.Addresses.Count == 0 || string.IsNullOrEmpty(sms.Message))
            {
                throw new ArgumentException("Invalid sms format.");
            }

            foreach (var address in sms.Addresses)
            {
                sms.TelAdresses = new List <string>();
                sms.TelAdresses.Add(this.IsValidMSISDN(address));
            }

            var smsForSending = new OutBoundSms {
                Address = sms.TelAdresses, Message = sms.Message
            };
            string body = JsonParser <OutBoundSms> .SerializeToJson(smsForSending);

            string relativeUri = string.Format("{0}{1}", EndPoint.AbsoluteUri, "/rest/sms/2/messaging/outbox");
            var    head        = new StringBuilder();

            this.GetClientCredentials();
            head.Append(string.Format("?Authorization=Bearer {0}", this.ClientCredential.AccessToken));

            return(SmsResponse.Parse(this.Send(relativeUri, head, body)));
        }
        /// <summary>
        /// Sends the SMS message.
        /// </summary>
        /// <param name="phoneNumbers">Phone numbers to send SMS message to.</param>
        /// <param name="message">Message body to send.</param>
        /// <returns>Instance of <see cref="SmsResponse"/> with sent SMS response information.</returns>
        /// <exception cref="System.ArgumentNullException">phoneNumbers is null.</exception>
        /// <exception cref="System.ArgumentException">phoneNumbers count equals zero.</exception>
        public async Task <SmsResponse> SendSms(IEnumerable <string> phoneNumbers, string message)
        {
            Argument.ExpectNotNull(() => phoneNumbers);
            Argument.Expect(() => phoneNumbers.Any(), "phoneNumbers", "at least one phone number required");

            List <string> isdnAddresses = phoneNumbers
                                          .Select(a => PhoneNumberConverter.ConvertToIsdn(a))
                                          .ToList();

            var body = String.Empty;

            if (isdnAddresses.Count == 1)
            {
                var raw = new OutboundSmsRaw(isdnAddresses[0], message);
                body = JsonParser <OutboundSmsRaw> .SerializeToJson(raw);
            }
            else
            {
                var numbers = new OutboundSms(isdnAddresses, message);
                body = JsonParser <OutboundSms> .SerializeToJson(numbers);
            }

            return(SmsResponse.Parse(await SendRawRequest(HttpMethod.Post, SendRelativeUrl, body)));
        }