public Task <ByteString> HandlePutState(
            string collection,
            string key,
            ByteString value,
            string channelId,
            string txId
            )
        {
            var payload = new PutState
            {
                Key        = key,
                Value      = value,
                Collection = collection
            };

            return(CreateMessageAndListen <ByteString>(MessageMethod.PutState, ChaincodeMessage.Types.Type.PutState,
                                                       payload,
                                                       channelId, txId));
        }
        static void Main(string[] args)
        {
            //Default Values
            String dWhatDoIControl = "groups";
            String dSubControl     = "1";

            PutState lightState      = new PutState();
            Color    lightColor      = new Color();
            Dim      lightBrightness = new Dim();

            bool continueRunning = true;

            do
            {
                Console.Write("HueCommand: ");
                String   input     = Console.ReadLine().ToLower();
                String[] arguments = input.Split(' ');

                //TODO: This needs to be implimented
                int      something     = 0;
                String[] targetCommand = overrideDefaults(dWhatDoIControl, dSubControl, arguments);
                for (int i = 0; i < targetCommand.Length; i++)
                {
                    for (int x = 0; x < arguments.Length; x++)
                    {
                        if (arguments[x] == targetCommand[i])
                        {
                            something = x + 1;
                        }
                    }
                }
                String whatToControl = targetCommand[0];
                String subControl    = targetCommand[1];

                object       thing   = new Def();
                IRestRequest request = new RestRequest();

                switch (arguments[something])
                {
                case "off":
                    lightState.on = false;
                    thing         = lightState;
                    break;

                case "on":
                    lightState.on = true;
                    thing         = lightState;
                    break;

                case "red":
                    lightColor.on  = true;
                    lightColor.hue = 65535;
                    lightColor.sat = 255;
                    thing          = lightColor;
                    break;

                case "green":
                    lightColor.on  = true;
                    lightColor.hue = 21845;
                    lightColor.sat = 255;
                    thing          = lightColor;
                    break;

                case "purple":
                    lightColor.on  = true;
                    lightColor.hue = 54000;
                    lightColor.sat = 255;
                    thing          = lightColor;
                    break;

                case "white":
                    lightColor.on  = true;
                    lightColor.hue = 65535;
                    lightColor.sat = 0;
                    thing          = lightColor;
                    break;

                case "blue":
                    lightColor.on  = true;
                    lightColor.hue = 43690;
                    lightColor.sat = 255;
                    thing          = lightColor;
                    break;

                case "dim":
                    lightBrightness.on = true;

                    if (arguments[arguments.Length - 1].ToLower() == "dim")
                    {
                        IRestResponse response;
                        if (whatToControl == "lights")
                        {
                            Console.WriteLine("This feature does not support the lights agrument yet.");
                            continue;
                        }
                        //response = MakeRequest(whatToControl, "", null, Method.GET);
                        response = MakeRequest(whatToControl, subControl, null, Method.GET);

                        //Console.WriteLine(response.Content);

                        Group responseObjectG = null;
                        //Lights responseObjectL = null;
                        if (whatToControl == "groups")
                        {
                            responseObjectG = JsonConvert.DeserializeObject <Group>(response.Content);
                        }
                        //else responseObjectL = JsonConvert.DeserializeObject<Lights>(response.Content);

                        int brightness = 0;
                        if (responseObjectG != null)
                        {
                            brightness = responseObjectG.Action.Bri;
                        }
                        //if (responseObjectL != null && arguments.Length == 3) Console.WriteLine(responseObjectL.lightID[Int16.Parse(arguments[arguments.Length - 2])]);
                        //else if (responseObjectL != null) Console.WriteLine(responseObjectL.lightID[0];

                        lightBrightness.bri = brightness - 40;
                        thing = lightBrightness;
                    }
                    else
                    {
                        try {
                            //dim to specified brightness
                            int brightness = Int32.Parse(arguments[arguments.Length - 1]);

                            if (brightness < 0 || brightness > 255)
                            {
                                throw new Exception();
                            }
                            else if (brightness < 100)
                            {
                                brightness = percentToHueBri(brightness);
                            }

                            lightBrightness.bri = brightness;
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine("Incorrect Syntax, Please Try Again.\n" +
                                              "[Controller System] [ID] dim [% Brightness]\n");
                            continue;
                        }
                    }
                    thing = lightBrightness;
                    break;

                default:
                    Console.WriteLine("Incorrect Syntax, Please Try Again.");
                    break;
                }
                //Console.WriteLine("What to control: " + whatToControl + "\n" +
                //    "Subcontrol: " + subControl + "\n" + "Thing: " + thing.ToString() + "\n");
                MakeRequest(whatToControl, subControl, thing, Method.PUT);
            }while (continueRunning);
        }