private async void Run()
        {
            await _HubConnection.Start();

            var cam = new MediaCapture();

            await cam.InitializeAsync(new MediaCaptureInitializationSettings()
            {
                MediaCategory        = MediaCategory.Media,
                StreamingCaptureMode = StreamingCaptureMode.Video
            });

            _Sensor.MotionDetected += async(int pinNum) =>
            {
                var    stream      = new InMemoryRandomAccessStream();
                Stream imageStream = null;
                try
                {
                    await Task.Factory.StartNew(async() =>
                    {
                        _Sensor.IsActive = false;
                        await cam.CapturePhotoToStreamAsync(ImageEncodingProperties.CreateJpeg(), stream);
                        stream.Seek(0);
                        imageStream = stream.AsStream();
                        imageStream.Seek(0, SeekOrigin.Begin);
                        string imageUrl = await NotificationHelper.UploadImageAsync(imageStream);

                        switch (await OxfordHelper.IdentifyAsync(imageUrl))
                        {
                        case AuthenticationResult.IsOwner:
                            // open the door
                            MotorController.PWM(26);
                            break;

                        case AuthenticationResult.Unkown:
                            // send notification to the owner
                            NotificationHelper.NotifyOwnerAsync(imageUrl);
                            break;

                        case AuthenticationResult.None:
                        default:
                            break;
                        }
                        _Sensor.IsActive = true;
                    });
                }
                finally
                {
                    if (stream != null)
                    {
                        stream.Dispose();
                    }
                    if (imageStream != null)
                    {
                        imageStream.Dispose();
                    }
                }
            };
        }
        public VisitorsController()
        {
            IHubProxy DoorHubProxy = _HubConnection.CreateHubProxy("DoorHub");

            DoorHubProxy.On("GetMessage", async() =>
            {
                _Sensor.IsActive = false;
                MotorController.PWM(26);
                await Task.Delay(20000);
                _Sensor.IsActive = true;
            });
            Run();
        }