public void Run(IBackgroundTaskInstance taskInstance)
        {
            Logger.Current.Init(LogType.AudioFunction);

            PlayQueueManager.Current.Connect();

            systemMediaTransportControls = SystemMediaTransportControls.GetForCurrentView();
            systemMediaTransportControls.ButtonPressed += HandleSystemMediaTransportControlsButtonPressed;
            systemMediaTransportControls.PropertyChanged += HandleSystemMediaTransportControlsPropertyChanged;
            systemMediaTransportControls.IsEnabled = true;
            systemMediaTransportControls.IsPauseEnabled = true;
            systemMediaTransportControls.IsPlayEnabled = true;
            systemMediaTransportControls.IsNextEnabled = true;
            systemMediaTransportControls.IsPreviousEnabled = true;

            taskInstance.Canceled += HandleTaskInstanceCanceled;
            taskInstance.Task.Completed += HandleTaskInstanceTaskCompleted;
            taskInstance.Task.Progress += Task_Progress;

            BackgroundMediaPlayer.Current.CurrentStateChanged += HandleBackgroundMediaPlayerCurrentStateChanged;
            BackgroundMediaPlayer.Current.SeekCompleted += HandleBackgroundMediaPlayerSeekComplete;
            BackgroundMediaPlayer.MessageReceivedFromForeground += HandleBackgroundMediaPlayerMessageReceivedFromForeground;

            backgroundTaskStarted.Set();
            backgroundTaskState = BackgroundTaskState.Running;

            backgroundTaskDefferal = taskInstance.GetDeferral();

            PlayQueueManager.Current.TrackChanged += HandlePlayQueueTrackChanged;

            ApplicationSettings.PutSettingsValue(ApplicationSettings.IS_BACKGROUND_PROCESS_ACTIVE, true);

            if (ApplicationSettings.GetSettingsValue<bool>(ApplicationSettings.IS_FOREGROUND_PROCESS_ACTIVE, false))
            {
                Logger.Current.Init(LogType.AudioFunction);

                Logger.Current.Log(new CallerInfo(), LogLevel.Info, "Sending message to the FG -- BackgroundStarted");

                PlayQueueManager.Current.SendMessageToForeground(PlayQueueConstantBGMessageId.BackgroundStarted);
                foregroundTaskState = ForegroundTaskState.Running;
            }
            else
            {
                Logger.Current.Init(LogType.AudioFunction);

                Logger.Current.Log(new CallerInfo(), LogLevel.Info, "Didn't send message to the FG because FG not started");

                foregroundTaskState = ForegroundTaskState.Stopped;
            }
        }
        void HandleBackgroundMediaPlayerMessageReceivedFromForeground(object sender, MediaPlayerDataReceivedEventArgs e)
        {
            foreach (string key in e.Data.Keys)
            {
                switch (key.ToLower())
                {
                    case PlayQueueMessageHelper.AppSuspended:
                        foregroundTaskState = ForegroundTaskState.Stopped;
                        Logger.Current.Init(LogType.AudioFunction);

                        Logger.Current.Log(new CallerInfo(), LogLevel.Info, "GOT SUSPEND EVENT");

                        break;
                    case PlayQueueMessageHelper.AppResumed:
                        foregroundTaskState = ForegroundTaskState.Running;
                        break;
                    case PlayQueueMessageHelper.StartPlayback:
                        PlayQueueManager.Current.Play();
                        break;
                    case PlayQueueMessageHelper.PrevTrack:
                        SkipToPrevious();
                        break;
                    case PlayQueueMessageHelper.SkipTrack:
                        SkipToNext();
                        break;
                    case PlayQueueMessageHelper.PossibleChromeChange:
                        systemMediaTransportControls.IsNextEnabled = PlayQueueManager.Current.CanSkip();
                        systemMediaTransportControls.IsPreviousEnabled = PlayQueueManager.Current.CanBack();
                        break;
                    case PlayQueueMessageHelper.PlayPauseTrack:
                        Logger.Current.Log(new CallerInfo(), LogLevel.Info, "PlayPause State: {0}", BackgroundMediaPlayer.Current.CurrentState);

                        bool isActiveAndValidState = false;

                        if (PlayQueueManager.Current.IsActive)
                        {
                            if (BackgroundMediaPlayer.Current.CurrentState == MediaPlayerState.Playing)
                            {
                                BackgroundMediaPlayer.Current.Pause();

                                isActiveAndValidState = true;
                            }
                            else if (BackgroundMediaPlayer.Current.CurrentState == MediaPlayerState.Paused)
                            {
                                BackgroundMediaPlayer.Current.Play();

                                isActiveAndValidState = true;
                            }
                        }

                        if (!isActiveAndValidState)
                        {
                            // TODO: #16 flashy flash goes the play button
                            if (backgroundTaskState != BackgroundTaskState.Running)
                            {
                                bool success = backgroundTaskStarted.WaitOne(5000);
                                if (!success)
                                {
                                    throw new Exception("BackgroundProccessLaunchFailed");
                                }
                            }

                            StartPlayback();
                        }
                        break;

                    case PlayQueueMessageHelper.LoggingEnabledChanged:
                        
                        break;
                    case PlayQueueMessageHelper.ScrubToPercentage:
                        Seek(DebugHelper.CastAndAssert<double>(e.Data[key]));
                        break;
                    case PlayQueueMessageHelper.PlayMode:
                        BackgroundMediaPlayer.Current.IsLoopingEnabled = !BackgroundMediaPlayer.Current.IsLoopingEnabled;
                        break;
                    case PlayQueueMessageHelper.Volume:
                        BackgroundMediaPlayer.Current.Volume = DebugHelper.CastAndAssert<double>(e.Data[key]);
                        break;
                }
            }
        }