/// <summary>
        /// Create Territory with Rectangular Shape
        /// </summary>
        public void CreateRectTerritory()
        {
            // Create the manager with the api key
            Route4MeManager route4Me = new Route4MeManager(c_ApiKey);

            AvoidanceZoneParameters territoryParameters = new AvoidanceZoneParameters
            {
                TerritoryName = "Test Territory",
                TerritoryColor = "ff0000",
                Territory = new Territory
                {
                    Type = TerritoryType.Rect.Description(),
                    Data = new string[] {
                        "43.51668853502909,-109.3798828125",
                        "46.98025235521883,-101.865234375"
                    }
                }
            };

            // Run the query
            string errorString = "";
            AvoidanceZone territory = route4Me.CreateTerritory(territoryParameters, out errorString);

            Console.WriteLine("");

            if (territory != null)
            {
                Console.WriteLine("CreateRectTerritory executed successfully");
                Console.WriteLine("Territory ID: {0}", territory.TerritoryId);
            }
            else
            {
                Console.WriteLine("CreateRectTerritory error: {0}", errorString);
            }
        }
        /// <summary>
        /// Update Avoidance Zone
        /// </summary>
        /// <param name="territoryId"> Avoidance Zone Id </param>
        public void UpdateAvoidanceZone(string territoryId)
        {
            // Create the manager with the api key
              Route4MeManager route4Me = new Route4MeManager(c_ApiKey);

              AvoidanceZoneParameters avoidanceZoneParameters = new AvoidanceZoneParameters()
              {
            TerritoryId = territoryId,
            TerritoryName = "Test Territory Updated",
            TerritoryColor = "ff00ff",
            Territory = new Territory()
            {
              Type = TerritoryType.Circle.Description(),
              Data = new string[] { "38.41322259056806,-78.501953234",
                                "3000"}
            }
              };

              // Run the query
              string errorString;
              AvoidanceZone avoidanceZone = route4Me.UpdateAvoidanceZone(avoidanceZoneParameters, out errorString);

              Console.WriteLine("");

              if (avoidanceZone != null)
              {
            Console.WriteLine("UpdateAvoidanceZone executed successfully");

            Console.WriteLine("Territory ID: {0}", avoidanceZone.TerritoryId);
              }
              else
              {
            Console.WriteLine("UpdateAvoidanceZone error: {0}", errorString);
              }
        }
        /// <summary>
        /// Add Polygon Avoidance Zone
        /// </summary>
        /// <returns> Id of added territory </returns>
        public string AddPolygonAvoidanceZone()
        {
            // Create the manager with the api key
            Route4MeManager route4Me = new Route4MeManager(c_ApiKey);

            AvoidanceZoneParameters avoidanceZoneParameters = new AvoidanceZoneParameters
            {
                TerritoryName = "Test Territory",
                TerritoryColor = "ff0000",
                Territory = new Territory
                {
                    Type = TerritoryType.Poly.Description(),
                    Data = new string[] {
                        "37.569752822786455,-77.47833251953125",
                        "37.75886716305343,-77.68974800109863",
                        "37.74763966054455,-77.6917221069336",
                        "37.74655084306813,-77.68863220214844",
                        "37.7502255383101,-77.68125076293945",
                        "37.74797991274437,-77.67498512268066",
                        "37.73327960206065,-77.6411678314209",
                        "37.74430510679532,-77.63172645568848",
                        "37.76641925847049,-77.66846199035645"
                    }
                }
            };

            // Run the query
            string errorString;
            AvoidanceZone avoidanceZone = route4Me.AddAvoidanceZone(avoidanceZoneParameters, out errorString);

            Console.WriteLine("");

            if (avoidanceZone != null)
            {
                Console.WriteLine("AddPolygonAvoidanceZone executed successfully");

                Console.WriteLine("Territory ID: {0}", avoidanceZone.TerritoryId);

                return avoidanceZone.TerritoryId;
            }
            else
            {
                Console.WriteLine("AddPolygonAvoidanceZone error: {0}", errorString);

                return null;
            }
        }
        /// <summary>
        /// Add Rectangular Avoidance Zone
        /// </summary>
        /// <returns> Id of added territory </returns>
        public string AddRectAvoidanceZone()
        {
            // Create the manager with the api key
            Route4MeManager route4Me = new Route4MeManager(c_ApiKey);

            AvoidanceZoneParameters avoidanceZoneParameters = new AvoidanceZoneParameters
            {
                TerritoryName = "Test Territory",
                TerritoryColor = "ff0000",
                Territory = new Territory
                {
                    Type = TerritoryType.Rect.Description(),
                    Data = new string[] {
                        "43.51668853502909,-109.3798828125",
                        "46.98025235521883,-101.865234375"
                    }
                }
            };

            // Run the query
            string errorString;
            AvoidanceZone avoidanceZone = route4Me.AddAvoidanceZone(avoidanceZoneParameters, out errorString);

            Console.WriteLine("");

            if (avoidanceZone != null)
            {
                Console.WriteLine("AddRectAvoidanceZone executed successfully");

                Console.WriteLine("Territory ID: {0}", avoidanceZone.TerritoryId);

                return avoidanceZone.TerritoryId;
            }
            else
            {
                Console.WriteLine("AddRectAvoidanceZone error: {0}", errorString);

                return null;
            }
        }
        /// <summary>
        /// Add Avoidance Zone
        /// </summary>
        /// <returns> Id of added territory </returns>
        public string AddAvoidanceZone()
        {
            // Create the manager with the api key
              Route4MeManager route4Me = new Route4MeManager(c_ApiKey);

              AvoidanceZoneParameters avoidanceZoneParameters = new AvoidanceZoneParameters()
              {
            TerritoryName = "Test Territory",
            TerritoryColor = "ff0000",
            Territory = new Territory()
            {
              Type = TerritoryType.Circle.Description(),
              Data = new string[] { "37.569752822786455,-77.47833251953125",
                                "5000"}
            }
              };

              // Run the query
              string errorString;
              AvoidanceZone avoidanceZone = route4Me.AddAvoidanceZone(avoidanceZoneParameters, out errorString);

              Console.WriteLine("");

              if (avoidanceZone != null)
              {
            Console.WriteLine("AddAvoidanceZone executed successfully");

            Console.WriteLine("Territory ID: {0}", avoidanceZone.TerritoryId);

            return avoidanceZone.TerritoryId;
              }
              else
              {
            Console.WriteLine("AddAvoidanceZone error: {0}", errorString);

            return null;
              }
        }
        /// <summary>
        /// Update Territory
        /// </summary>
        public void UpdateTerritory()
        {
            // Create the manager with the api key
            Route4MeManager route4Me = new Route4MeManager(c_ApiKey);

            string territoryId = "1CEFEC7568D900FB781C21603780775E";

            AvoidanceZoneParameters territoryParameters = new AvoidanceZoneParameters
            {
                TerritoryId = territoryId,
                TerritoryName = "Test Territory Updated",
                TerritoryColor = "ff0000",
                Territory = new Territory
                {
                    Type = TerritoryType.Circle.Description(),
                    Data = new string[] {
                        "37.569752822786455,-77.47833251953125",
                        "6000"
                    }
                }
            };

            // Run the query
            string errorString = "";
            AvoidanceZone territory = route4Me.UpdateTerritory(territoryParameters, out errorString);

            Console.WriteLine("");

            if (territory != null)
            {
                Console.WriteLine("UpdateTerritory executed successfully");
                Console.WriteLine("Territory ID: {0}", territory.TerritoryId);
            }
            else
            {
                Console.WriteLine("UpdateTerritory error: {0}", errorString);
            }
        }