public async Task RunAsync(IBackgroundTaskInstance taskInstance)
        {
            deferral = taskInstance.GetDeferral();

            Configuration configuration = new Configuration();

            DefaultConfigurationLoader.Load(configuration);
            ApplicationTriggerConfigurationLoader.Load(configuration, taskInstance.TriggerDetails as ApplicationTriggerDetails);
            ApplicationTriggerDetails triggerDetails = taskInstance.TriggerDetails as ApplicationTriggerDetails;

            DeviceInformationCollection devices = await DeviceInformation.FindAllAsync(DeviceClass.VideoCapture);

            DeviceInformation device = devices.Where(d => d.EnclosureLocation != null).FirstOrDefault(d => d.EnclosureLocation.Panel == Panel.Back);

            if (device == null)
            {
                device = devices.FirstOrDefault();
            }

            captureService = new CaptureService(configuration.Interval, configuration.Delay, device);
            captureService.ExceptionHandler += OnCaptureException;
            captureService.TryStartIfNotStopped();

            IHttpHandler httpHandler = new AuthenticationHttpHandler(configuration.AuthenticationToken, this);

            server = new HttpServer(httpHandler);
            await server.StartAsync(configuration.Port);
        }