public IResponse Execute(string payload)
        {
            JObject o = JsonConvert.DeserializeObject<JObject>(payload);

            int id;
            int vertexId;

            if (!Int32.TryParse(o[ZoneIdKey].ToString(), out id) ||
                !Int32.TryParse(o[VertexIdKey].ToString(), out vertexId))
            {
                return new ResponseFailure(Name, "Parse error");
            }

            List<string> ports = new List<string>();
            foreach (Link l in Source.Links)
            {
                ports.Add(l.Address);
            }

            if (!ports.Contains(o[PortNameKey].ToString()))
            {
                return new ResponseFailure(Name, "Port not available");
            }

            RoadplusData data = new RoadplusData();
            Zone target;
            try
            {
                target = data.Zones.Single(z => z.ZoneId == id);
            }
            catch (InvalidOperationException)
            {
                return new ResponseFailure(Name, "Zone not found");
            }

            target.ArduinoPort = o[PortNameKey].ToString();
            target.RadarVertexId = vertexId;

            data.Update<Zone>(target);

            Link link = Source.GetLinkByAddress(o[PortNameKey].ToString());
            if (link is RoadLink)
            {
                RoadLink rlink = link as RoadLink;
                Service.Checker = new ZoneChecker(rlink, 5);
                return new ConnectRoadToZoneResponse()
                {
                    ZoneId = id,
                    RoadPort = o[PortNameKey].ToString()
                };
            }

            return new ResponseFailure(Name, "port not found or connected");
        }
        public IResponse Execute(string payload)
        {
            JObject json = JsonConvert.DeserializeObject<JObject>(payload);
            string name = json[NameKey].ToString();

            RoadplusData data = new RoadplusData();

            Zone newZone = new Zone()
            {
                Name = name,
                StartVertexId = 0,
                RadarVertexId = 0
            };

            int newZoneId = Convert.ToInt32(
                data.InsertWithIdentity<Zone>(newZone));

            Vertex startVertex = new Vertex()
            {
                X = 0,
                Y = 0,
                ZoneId = newZoneId
            };

            int startVertexId = Convert.ToInt32(
                data.InsertWithIdentity<Vertex>(startVertex));

            newZone.ZoneId = newZoneId;
            newZone.StartVertexId = startVertexId;

            data.Update<Zone>(newZone);
            
            CreateResponse response = new CreateResponse()
            {
                Command = Name,
                CreatedObject = newZone
            };

            return response;
        }