private static void UnmarshallResult(XmlUnmarshallerContext context, ListQueuesResponse response)
        {
            
            int originalDepth = context.CurrentDepth;
            int targetDepth = originalDepth + 1;
            
            if (context.IsStartOfDocument) 
               targetDepth += 2;
            
            while (context.ReadAtDepth(originalDepth))
            {
                if (context.IsStartElement || context.IsAttribute)
                {

                    if (context.TestExpression("QueueUrl", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        var item = unmarshaller.Unmarshall(context);
                        response.QueueUrls.Add(item);
                        continue;
                    }
                } 
           }

            return;
        }
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>  
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context)
        {
            ListQueuesResponse response = new ListQueuesResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;
            while (context.ReadAtDepth(targetDepth))
            {
                if (context.IsStartElement)
                {                    
                    if(context.TestExpression("ListQueuesResult", 2))
                    {
                        UnmarshallResult(context, response);                        
                        continue;
                    }
                    
                    if (context.TestExpression("ResponseMetadata", 2))
                    {
                        response.ResponseMetadata = ResponseMetadataUnmarshaller.Instance.Unmarshall(context);
                    }
                }
            }

            return response;
        }
        private static void UnmarshallResult(XmlUnmarshallerContext context,ListQueuesResponse response)
        {
            
            int originalDepth = context.CurrentDepth;
            int targetDepth = originalDepth + 1;
            
            if (context.IsStartOfDocument) 
               targetDepth += 2;
            
            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("QueueUrl", targetDepth))
                    {
                        response.QueueUrls.Add(StringUnmarshaller.GetInstance().Unmarshall(context));
                            
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth < originalDepth)
                {
                    return;
                }
            }
                            


            return;
        }
 private string TheQueueUrlFrom(ListQueuesResponse listQueuesResponse)
 {
     string queueUrl;
     if (listQueuesResponse.ListQueuesResult.QueueUrl.Count == 0)
     {
         var response = _client.CreateQueue(new CreateQueueRequest { QueueName = _config.SqsQueueName });
         queueUrl = response.CreateQueueResult.QueueUrl;
     }
     else
     {
         queueUrl = listQueuesResponse.ListQueuesResult.QueueUrl[0];
     }
     return queueUrl;
 }
        private ListQueuesResult requestListOfQueuesInSQS()
        {
            ListQueuesResponse objqueuesResponseList = new ListQueuesResponse();

            objqueuesResponseList = objClient.ListQueues(new ListQueuesRequest());

            ListQueuesResult Result = objqueuesResponseList.ListQueuesResult;

            return Result;
        }
        public ListQueuesResponse ListQueues(ListQueuesRequest request)
        {
            var urls = string.IsNullOrEmpty(request.QueueNamePrefix)
                ? queues.Keys
                : queues.Values
                    .Where(q => q.QueueDefinition
                        .QueueName.StartsWith(request.QueueNamePrefix, StringComparison.InvariantCultureIgnoreCase))
                    .Select(q => q.QueueDefinition.QueueUrl);

            var response = new ListQueuesResponse
            {
                QueueUrls = urls.ToList()
            };

            return response;
        }