/// <summary>
        /// Create the POST string from a batch of input addresses
        /// </summary>
        /// <param name="test"></param>
        /// <param name="currentRow"></param>
        /// <returns></returns>
        public static String CreatePOSTString(JSONRecordSet recordSet)
        {
            // Serialize into the JSON string
              JavaScriptSerializer jss = new JavaScriptSerializer();
              jss.MaxJsonLength = 2147483647; // 2147483647 is max int size
              String restRecordSetArray = jss.Serialize(recordSet);

              return restRecordSetArray;
        }
        static void Main(string[] args)
        {
            Console.WriteLine(m_inputTableName + " Executing...");
              String restURL = "https://" + m_serverName + "/arcgis/rest/services/World/GeocodeServer/geocodeAddresses";
              bool sslRequired = true;
              //m_token = GetTokenOAuth2(test.AppID, test.AppSecret, GetOAuth2TokenURL(test.ServerName), ref sslRequired);
              m_token = GetToken(m_username, m_password, GetTokenURL(m_serverName), ref sslRequired);
              List<GeocodedResult> geocodedResultList = null;

              // Populate the JSONRecordSet class to be used to Serialize into the JSON string
              JSONRecordSet recordSet = new JSONRecordSet();
              bool useSingleLine = false;
              if (m_addressFields[0] != "")
            useSingleLine = true;

              List<Attributes> addressTableList = readCSVRecordsAsList(m_inputTableName, m_addressFields, useSingleLine);

              // This while loop used to iterate through all of the batches of record sets
              int rowCount = addressTableList.Count;
              int batchSize = m_batchSize;
              int currentRow = 0;
              int startRow = 0;
              bool firstResult = true;
              while (currentRow < rowCount)
              {
            startRow = currentRow;
            currentRow += batchSize;
            if (currentRow >= rowCount)
            {
              batchSize = rowCount - startRow;
              currentRow = rowCount;
            }

            recordSet.records = addressTableList.GetRange(startRow, batchSize);

            // Create the POST string to pass to the server
            String postString = CreatePOSTString(recordSet);

            Stopwatch timer = new Stopwatch();
            timer.Start();
            // Make the request to the server
            String response = DoHttpRequest(restURL, "Addresses=" + HttpUtility.UrlEncode(postString), true, "POST", true);
            timer.Stop();
            Console.WriteLine("Elapsed time = " + timer.Elapsed);

            // Process the results
            if (response != null)
            {
              geocodedResultList = parseJsonResult(response);
              if (firstResult)
              {
            WriteResults(m_outputTableName, "ResultID,Loc_name,Status,Score,Match_addr,Addr_type,PlaceName,Rank,AddBldg,AddNum,AddNumFrom,AddNumTo,Side,StPreDir,StPreType,StName,StType,StDir,Nbrhd,City,Subregion,Region,Postal,PostalExt,Country,LangCode,Distance,X,Y,DisplayX,DisplayY,Xmin,Xmax,Ymin,Ymax", false);
            firstResult = false;
              }
              foreach (GeocodedResult geocodedResult in geocodedResultList)
              {
            WriteResults(m_outputTableName, GeocodedResultToString(geocodedResult), true);
              }
            }
            else
            {
              Console.WriteLine("An error occured processing the batch. See " + m_outputTableName + ".error for more information.");
              WriteResults(m_outputTableName + ".error", "Batch request with ID " + startRow + " through " + currentRow + " Failed.", true);
            }
            Console.WriteLine("Finished processing " + currentRow + " rows of " + rowCount);
              }
              Console.WriteLine("Batch geocoding completed.  Press Enter to continue...");
              Console.ReadLine();
        }