#pragma warning disable 1998
        /// <summary>
        /// Code running when the application starts or restarts
        /// </summary>
        /// <returns></returns>
        private async Task <SoundSensorStateReported> StartApplication(SoundSensorState desiredProperties)
        {
            _config = desiredProperties;

            if (_config != null)
            {
                if (_config.GpioConfig == null)
                {
                    _config.GpioConfig = new SoundSensorGpioConfig()
                    {
                        GpioSound = PIN_SOUND
                    };
                }

                if (_config.SoundTriggerDelay < SOUND_TRIGGER_DELAY_MINIMUM)
                {
                    _config.SoundTriggerDelay = SOUND_TRIGGER_DELAY_MINIMUM;
                }

                if (_config.State == DeviceState.On)
                {
                    _gpioService.InitGPIOInput(_config.GpioConfig.GpioSound, GpioSoundChanged);
                }
            }

            return(new SoundSensorStateReported()
            {
                DeviceState = _config
            });
        }