/// <summary>
 /// Returns the <see cref="Led"/> having the passed ID.
 /// The method throws a <see cref="ResourceNotFoundException"/> if the requested <see cref="Led"/> does not exist.
 /// The method throws a <see cref="BadRequestException"/> if the passed ID is invalid.
 /// </summary>
 /// <param name="ledId">ID of the requested <see cref="Led"/></param>
 /// <returns>the <see cref="Led"/> having the passed ID</returns>
 public Led GetLed(string ledId)
 {
     string[] split = ledId.Split(':');
     if (split.Length != 2)
     {
         throw new BadRequestException(BadRequestException.MSG_INVALID_LED_ID);
     }
     else
     {
         int         controllerId = ApiBase.ParseInt(split[0], BadRequestException.MSG_INVALID_LED_ID);
         int         ledNumber    = ApiBase.ParseInt(split[1], BadRequestException.MSG_INVALID_LED_ID);
         ILedDataSet lds          = _ledStorage.GetLed(controllerId, ledNumber);
         if (lds == null)
         {
             throw new ResourceNotFoundException(ResourceNotFoundException.MSG_LED_NOT_FOUND.Replace("{VALUE}", ledId));
         }
         else
         {
             Led led = new Led();
             led.ControllerId = lds.ControllerId;
             led.LedNumber    = lds.LedNumber;
             led.RgbValue     = lds.RgbValue;
             return(led);
         }
     }
 }
        /// <summary>
        /// Returns the list of <see cref="Leds"/> which are member of the <see cref="Group"/> having the specified <see cref="Group.Id"/>.
        /// The methods throws a <see cref="ResourceNotFoundException"/> if the underlying <see cref="Group"/> does not exist.
        /// </summary>
        /// <param name="id"><see cref="Group.Id"/></param>
        /// <returns><see cref="GroupLeds"/> containing the <see cref="Leds"/> being member of the <see cref="Group"/></returns>
        public GroupLeds GetGroupLeds(int id)
        {
            IGroupDataSet gds = _groupStorage.GetGroup(id);

            if (gds != null)
            {
                GroupLeds gLeds = new GroupLeds();
                gLeds.GroupId = gds.Id;
                foreach (string ledId in gds.Leds)
                {
                    ILedDataSet lds = _ledStorage.GetLed(ledId);
                    if (lds != null)
                    {
                        Led led = new Led();
                        led.ControllerId = lds.ControllerId;
                        led.LedNumber    = lds.LedNumber;
                        led.RgbValue     = lds.RgbValue;
                        gLeds.Leds.Add(led);
                    }
                }
                return(gLeds);
            }
            else
            {
                throw new ResourceNotFoundException(ResourceNotFoundException.MSG_GROUP_NOT_FOUND.Replace("{VALUE}", id + ""));
            }
        }