private void AfterAccessNotification(TokenCacheNotificationArgs args)
        {
            TokenCacheEntity tokenCacheEntity = new TokenCacheEntity(PartitionKey, _userId)
            {
                Token = Serialize(), PersonId = _personId
            };
            TableOperation     tokenCacheTableOperation = TableOperation.InsertOrReplace(tokenCacheEntity);
            Task <TableResult> tableOperationTask       = _tokenCacheTable.ExecuteAsync(tokenCacheTableOperation);

            if (!tableOperationTask.IsCompleted)
            {
                tableOperationTask.Wait();
            }
        }
        private void BeforeAccessNotification(TokenCacheNotificationArgs args)
        {
            TableOperation     tokenCacheTableOperation = TableOperation.Retrieve <TokenCacheEntity>(PartitionKey, _userId);
            Task <TableResult> tableOperationTask       = _tokenCacheTable.ExecuteAsync(tokenCacheTableOperation);

            if (!tableOperationTask.IsCompleted)
            {
                tableOperationTask.Wait();
            }
            TableResult tokenRecords = tableOperationTask.Result;

            if (tokenRecords.Result == null)
            {
                _tokenCacheEntity = new TokenCacheEntity(PartitionKey, _userId);
            }
            else
            {
                TokenCacheEntity tokenCacheEntity = (TokenCacheEntity)tokenRecords.Result;
                Deserialize(tokenCacheEntity.Token);
                _tokenCacheEntity = tokenCacheEntity;
                _personId         = _tokenCacheEntity.PersonId;
            }
        }