public async Task <ITwitterCredentials> AuthenticateWithCachingAsync() { var configRepo = new ConfigRepository(); var config = configRepo.LoadNullable(); if (config != null) { var t = config.TwitterAccessToken; var userCred = new TwitterCredentials( t.ConsumerKey, t.ConsumerSecret, t.AccessTokenKey, t.AccessTokenSecret ); return(userCred); } else { var userCred = await AuthenticateAsync(); var twitterAccessToken = new TwitterAccessToken( userCred.ConsumerKey, userCred.ConsumerSecret, userCred.AccessToken, userCred.AccessTokenSecret ); var newConfig = new Config(twitterAccessToken); configRepo.Save(newConfig); return(userCred); } }