/// <summary>
        /// Saves the changes.
        /// </summary>
        /// <returns></returns>
        private bool SaveChanges()
        {
            OutgoingMessageType messageType =(OutgoingMessageType)StringEnum.Parse(typeof(OutgoingMessageType), cboMessageType.Text);
          
            // Validate recipients are not empty
            if (!FormHelper.ValidateNotEmpty(txtTo, Resources.MsgRecipientsRequired))
            {
                return false;
            }

            if (messageType == OutgoingMessageType.SMS) 
            {
                // Validate message is not empty
                if (!FormHelper.ValidateNotEmpty(txtMessageContent, Resources.MsgContentRequired))
                {
                    return false;
                }
            } 
            else if (messageType == OutgoingMessageType.WAPPush)
            {
                 // Validate URL
                if (!FormHelper.ValidateNotEmpty(txtWapPushUrl, Resources.MsgURLRequired))
                {
                    return false;
                }

                // Validate message is not empty
                if (!FormHelper.ValidateNotEmpty(txtWapPushMessage, Resources.MsgContentRequired))
                {
                    return false;
                }
            }


            // The To list can be separated by comma or semicolon
            string[] toList = txtTo.Text.Split(GuiHelper.SupportedSeparators, StringSplitOptions.RemoveEmptyEntries);                                   
            try
            {  
                string groupId = GatewayHelper.GenerateUniqueIdentifier();  
                using (SharedDbConnectionScope sharedConnectionScope = new SharedDbConnectionScope())
                {                    
                    using (TransactionScope ts = new TransactionScope())
                    {
                        try
                        {
                            foreach (string to in toList)
                            {
                                OutgoingMessage message = new OutgoingMessage();
                                message.Id = GatewayHelper.GenerateUniqueIdentifier();
                                message.GatewayId = cboChannel.Text;
                                message.Recipient = to.Trim();
                                message.Originator = txtFrom.Text;
                                message.MessageType = cboMessageType.Text;                                
                                message.MessageFormat = cboMessageFormat.Text;
                                message.LastUpdate = DateTime.Now;
                                message.CreateDate = message.LastUpdate;
                                message.SrcPort = Convert.ToInt32(npdSourcePort.Value);
                                message.DestPort = Convert.ToInt32(npdDestinationPort.Value);
                                message.Status = StringEnum.GetStringValue(MessageStatus.Pending);
                                message.MessageClass = cboMessageClass.Text;
                                message.Priority = cboPriority.Text;
                                message.StatusReport = cboStatusReport.Text;
                                message.Quantity = Convert.ToInt32(npdQuantity.Value);
                                message.GroupId = groupId;
                                if (chkScheduleSendTime.Checked)
                                    message.ScheduledDate = dtpScheduleTime.Value;

                                if (messageType == OutgoingMessageType.SMS)
                                {
                                    message.Message = txtMessageContent.Text;
                                }
                                else if (messageType == OutgoingMessageType.WAPPush)
                                {
                                    message.WapUrl = txtWapPushUrl.Text;
                                    message.WapSignal = cboWapPushSignal.Text;
                                    message.Message = txtWapPushMessage.Text;
                                    if (chkWapPushCreated.Checked)
                                        message.WapCreateDate = dtpWapPushCreated.Value;
                                    if (chkWapPushExpiry.Checked)                                    
                                        message.WapExpiryDate = dtpWapPushExpiryDate.Value;
                                    
                                }

                                message.Save();
                            }
                        }
                        finally
                        {
                            try
                            {
                                ts.Complete();
                            }
                            catch (Exception) { }   
                            
                            // Refresh the message view
                            RefreshMessageView(ViewAction.RefreshOutbox);
                        }
                    }
                }
               
            }
            catch (Exception ex)
            {
                FormHelper.ShowError(ex.Message);
                return false;
            }

            // Show successful save message
            if (toList.Count() == 1)
            {
                FormHelper.ShowInfo(Resources.MsgSingleMessageCreated);
            }
            else
            {
                FormHelper.ShowInfo(string.Format(Resources.MsgMultipleMessagesCreated, toList.Count()));
            }

            return true;
        }