private async Task HandleNotificationInternalAsync(SessionNotification notification, IProgressContext progress)
        {
            if (Resolve.Log.IsInfoEnabled)
            {
                Resolve.Log.LogInfo("Received notification type '{0}'.".InvariantFormat(notification.NotificationType));
            }
            EncryptionParameters encryptionParameters;

            switch (notification.NotificationType)
            {
            case SessionNotificationType.WatchedFolderAdded:
            case SessionNotificationType.WatchedFolderOptionsChanged:
                progress.NotifyLevelStart();
                try
                {
                    foreach (string fullName in notification.FullNames)
                    {
                        WatchedFolder watchedFolder = _fileSystemState.WatchedFolders.First(wf => wf.Path == fullName);

                        encryptionParameters = new EncryptionParameters(Resolve.CryptoFactory.Default(New <ICryptoPolicy>()).CryptoId, notification.Identity);
                        await encryptionParameters.AddAsync(await watchedFolder.KeyShares.ToAvailableKnownPublicKeysAsync(notification.Identity));

                        IDataContainer container = New <IDataContainer>(watchedFolder.Path);
                        progress.Display = container.Name;
                        IDataContainer[] dc = new IDataContainer[] { container };
                        await _axCryptFile.EncryptFoldersUniqueWithBackupAndWipeAsync(dc, encryptionParameters, progress);
                    }
                }
                finally
                {
                    progress.NotifyLevelFinished();
                }
                progress.Totals.ShowNotification();
                break;

            case SessionNotificationType.WatchedFolderRemoved:
                foreach (string fullName in notification.FullNames)
                {
                    IDataContainer removedFolderInfo = New <IDataContainer>(fullName);
                    progress.Display = removedFolderInfo.Name;
                    if (removedFolderInfo.IsAvailable)
                    {
                        await _axCryptFile.DecryptFilesInsideFolderUniqueWithWipeOfOriginalAsync(removedFolderInfo, notification.Identity, _statusChecker, progress).Free();
                    }
                }
                break;

            case SessionNotificationType.SignIn:
                await EncryptWatchedFoldersIfSupportedAsync(notification.Identity, notification.Capabilities, progress);

                break;

            case SessionNotificationType.SignOut:
                New <IInternetState>().Clear();
                New <ICache>().RemoveItem(CacheKey.RootKey);
                New <UserPublicKeyUpdateStatus>().Clear();
                break;

            case SessionNotificationType.EncryptPendingFiles:
                await _activeFileAction.ClearExceptionState();

                await _activeFileAction.PurgeActiveFiles(progress);

                if (_knownIdentities.DefaultEncryptionIdentity != LogOnIdentity.Empty)
                {
                    await EncryptWatchedFoldersIfSupportedAsync(_knownIdentities.DefaultEncryptionIdentity, notification.Capabilities, progress);
                }
                break;

            case SessionNotificationType.UpdateActiveFiles:
                await _fileSystemState.UpdateActiveFiles(notification.FullNames);

                break;

            case SessionNotificationType.ActiveFileChange:
            case SessionNotificationType.SessionStart:
            case SessionNotificationType.WatchedFolderChange:
            case SessionNotificationType.ProcessExit:
            case SessionNotificationType.KnownKeyChange:
            case SessionNotificationType.SessionChange:
            case SessionNotificationType.WorkFolderChange:
                await _activeFileAction.CheckActiveFiles(progress);

                break;

            case SessionNotificationType.LicensePolicyChanged:
            case SessionNotificationType.RefreshLicensePolicy:
                break;

            default:
                throw new InvalidOperationException("Unhandled notification received");
            }
        }