public void DeleteGroup(HttpContext context, string groupId)
        {
            int id = ApiBase.ParseId(groupId);

            _groupHandler.DeleteGroup(id);
            context.Response.Status = HttpStatus.OK;
        }
        public void SetGroup(HttpContext context, string groupId)
        {
            if (context.Request.Payload.Length > 0)
            {
                string json  = context.Request.Payload.ReadAll();
                Group  group = JsonSerializer.DeserializeJson <Group>(json);

                int id = ApiBase.ParseId(groupId);
                if (group == null)
                {
                    throw new BadRequestException(BadRequestException.MSG_INVALID_PAYLOAD);
                }
                else
                {
                    _groupHandler.ChangeName(id, group.Name);

                    Group  response     = _groupHandler.GetGroup(id);
                    string jsonResponse = JsonSerializer.SerializeJson(response);
                    context.Response.Payload.Write(jsonResponse);
                    context.Response.Status = HttpStatus.OK;
                }
            }
            else
            {
                throw new BadRequestException(BadRequestException.MSG_PAYLOAD_EXPECTED);
            }
        }
        public void DeleteController(HttpContext context, string controllerId)
        {
            int id = ApiBase.ParseId(controllerId);

            _controllerHandler.DeleteController(id);
            context.Response.Status = HttpStatus.OK;
        }
        public void SetController(HttpContext context, string controllerId)
        {
            if (context.Request.Payload.Length > 0)
            {
                string     json       = context.Request.Payload.ReadAll();
                Controller controller = JsonSerializer.DeserializeJson <Controller>(json);

                int id = ApiBase.ParseId(controllerId);
                if (controller == null)
                {
                    throw new BadRequestException(BadRequestException.MSG_INVALID_PAYLOAD);
                }
                else
                {
                    _controllerHandler.ChangeController(id, controller.Name, controller.LedCount);

                    Controller response     = _controllerHandler.GetController(id);
                    string     jsonResponse = JsonSerializer.SerializeJson(response);
                    context.Response.Payload.Write(jsonResponse);
                    context.Response.Status = HttpStatus.OK;
                }
            }
            else
            {
                throw new BadRequestException(BadRequestException.MSG_PAYLOAD_EXPECTED);
            }
        }
        public void GetController(HttpContext context, string controllerId)
        {
            int    id   = ApiBase.ParseId(controllerId);
            string json = JsonSerializer.SerializeJson(_controllerHandler.GetController(id));

            context.Response.Payload.Write(json);
            context.Response.Status = HttpStatus.OK;
        }
        public void GetLedsOfGroup(HttpContext context, string groupId)
        {
            int       id        = ApiBase.ParseId(groupId);
            GroupLeds groupLeds = _groupHandler.GetGroupLeds(id);
            string    json      = JsonSerializer.SerializeJson(groupLeds);

            context.Response.Payload.Write(json);
            context.Response.Status = HttpStatus.OK;
        }
        public void SetColorOfGroup(HttpContext context, string groupId)
        {
            if (context.Request.Payload.Length > 0)
            {
                string   json     = context.Request.Payload.ReadAll();
                RgbValue rgbValue = JsonSerializer.DeserializeJson <RgbValue>(json);

                int id = ApiBase.ParseId(groupId);
                if (rgbValue == null)
                {
                    throw new BadRequestException(BadRequestException.MSG_INVALID_PAYLOAD);
                }
                _groupHandler.SetColorOfGroup(id, rgbValue.Rgb);
                context.Response.Status = HttpStatus.OK;
            }
            else
            {
                throw new BadRequestException(BadRequestException.MSG_PAYLOAD_EXPECTED);
            }
        }