public async Task RequestRefresh(Guid userId, IAccount account, ContactRefreshTriggers triggeredBy)
        {
            var evt = new RefreshContactsCommand
            {
                RefreshTrigger = triggeredBy.ToString(),
                TimeStamp = DateTimeOffset.Now,
                UserId = userId,
                Provider = account.Provider,
                AccountId = account.AccountId,
                DisplayName = account.DisplayName,
                CurrentSession = new SessionRecord(account.CurrentSession)
            }.ToJson();

            await _eventStoreClient.SaveEvent(ContactStreamNames.AccountRefreshRequests(), ExpectedVersion.Any, Guid.NewGuid(), ContactEventType.AccountContactRefreshRequest, evt);
        }
 private async Task RequestAccountRefresh(User user, ContactRefreshTriggers triggeredBy)
 {
     Logger.Trace("Requesting account refresh for userId {0}", user.Id);
     await Task.WhenAll(
         user.Accounts.Select(account =>
             _accountContactRefresher.RequestRefresh(user.Id, account, triggeredBy)
         ));
 }
 private async Task RequestAccountRefreshForAllUserAccounts(User user, ContactRefreshTriggers triggeredBy)
 {
     Logger.Trace("Requesting account refresh for userId {0}", user.Id);
     await Task.Factory.StartNew(() =>
         {
             foreach (var acc in user.Accounts)
             {
                 RequestAccountRefresh(user.Id, triggeredBy, acc);
             }
         });
 }
 private void RequestAccountRefresh(Guid userId, ContactRefreshTriggers triggeredBy, IAccount acc)
 {
     Logger.Trace("Requesting account refresh for userId:'{0}', AccountId:'{1}'", userId, acc.AccountId);
     var refreshRequest = new AccountContactRefreshRequest(userId, acc, triggeredBy);
     _accountRefreshRequests.OnNext(refreshRequest);
 }