public override void HandleRequest(HttpListenerContext context)
        {
            var q = context.Request.QueryString;

            try
            {
                var fids  = getIntArgArray(q.Get(KEY_FIXTURE_ID));
                var patch = q.Get(KEY_PATCH_TYPE);

                if (fids == null || patch == null)
                {
                    throw new ArgumentNullException("Some of fixture edit properties was null");
                }

                var fixtures = StateManager.Instance.State.GetFixtures(fids);


                foreach (var f in fixtures)
                {
                    f.TrySetPatch(RestCreateFixtureHandler.getPixelPatch(patch));
                }

                SetInfoMessage(
                    "Pixel patch for fixtures: " + Fixture.GetFixtureListNameString(fixtures)
                    + " is set to: " + RestCreateFixtureHandler.getPixelPatch(patch).ToString(),
                    IS_PART_OF_STATE,
                    Talker.Talk.GetSource()
                    );

                string state = StateManager.Instance.GetStateSerialized();
                WriteResponse(context, RestConst.RESPONSE_OK, RestConst.CONTENT_TEXT_JSON, state);
            }
            catch (Exception e)
            {
                SetErrorMessage(e.ToString(), IS_NOT_PART_OF_STATE, Talker.Talk.GetSource());
                WriteErrorMessage(context, e);
            }
        }
        public override void HandleRequest(HttpListenerContext context)
        {
            var q = context.Request.QueryString;

            try
            {
                var fids      = getIntArgArray(q.Get(KEY_FIXTURE_ID));
                var name      = q.Get(KEY_NAME);
                var port      = getIntArgArray(q.Get(KEY_PORT));
                var addr      = q.Get(KEY_ADDRESS);
                var mode      = q.Get(KEY_MODE);
                var patch     = q.Get(KEY_PATCH_TYPE);
                var increment = bool.Parse(q.Get(KEY_INCREMENT));

                if (fids == null || name == null || port == null ||
                    addr == null || mode == null || patch == null)
                {
                    throw new ArgumentNullException("Some of fixture edit properties was null");
                }

                var portObj = new Port()
                {
                    Net      = port[0],
                    SubNet   = port[1],
                    Universe = port[2]
                };

                Address address = new Address()
                {
                    DmxAddress = int.Parse(addr),
                    Port       = portObj
                };

                var fixtures = StateManager.Instance.State.GetFixtures(fids);

                var i = 0;
                foreach (var f in fixtures)
                {
                    f.TrySetPatch(RestCreateFixtureHandler.getPixelPatch(patch));
                    f.SetMode(RestCreateFixtureHandler.GetFixtureMode(mode));

                    f.Name = name + " " + i;
                    if (increment)
                    {
                        f.Address             = address.Clone();
                        f.Address.DmxAddress += f.CurrentInputAddressCount * i;
                    }
                    else
                    {
                        f.Address = address.Clone();
                    }
                    i++;
                }

                SetInfoMessage(
                    "Fixtures: " + Fixture.GetFixtureListNameString(fixtures)
                    + " edit successfull",
                    IS_PART_OF_STATE,
                    Talker.Talk.GetSource());

                string state = StateManager.Instance.GetStateSerialized();
                WriteResponse(context, RestConst.RESPONSE_OK, RestConst.CONTENT_TEXT_JSON, state);
            }
            catch (Exception e) {
                SetErrorMessage(e.ToString(), IS_NOT_PART_OF_STATE, Talker.Talk.GetSource());
                WriteErrorMessage(context, e);
            }
        }