public static string TwitterBlockUsers(string profileId, string toTwitterUserId, Model.DatabaseRepository dbr, ILogger _logger, Helper.Cache _redisCache, Helper.AppSettings _appSettings) { Domain.Socioboard.Models.TwitterAccount twtacc = new Domain.Socioboard.Models.TwitterAccount(); Domain.Socioboard.Models.TwitterAccount imtwtacc = _redisCache.Get <Domain.Socioboard.Models.TwitterAccount>(Domain.Socioboard.Consatants.SocioboardConsts.CacheTwitterAccount + profileId); if (imtwtacc == null) { twtacc = dbr.Find <Domain.Socioboard.Models.TwitterAccount>(t => t.twitterUserId.Equals(profileId)).FirstOrDefault(); if (twtacc != null) { _redisCache.Set(Domain.Socioboard.Consatants.SocioboardConsts.CacheTwitterAccount + profileId, twtacc); } } else { twtacc = imtwtacc; } oAuthTwitter oAuth = new oAuthTwitter(_appSettings.twitterConsumerKey, _appSettings.twitterConsumerScreatKey, _appSettings.twitterRedirectionUrl); oAuth.AccessToken = twtacc.oAuthToken; oAuth.AccessTokenSecret = twtacc.oAuthSecret; oAuth.TwitterScreenName = twtacc.twitterScreenName; oAuth.TwitterUserId = twtacc.twitterUserId; Blocks blkss = new Blocks(); try { string blockUserResp = blkss.BlocksUserByUserId(oAuth, toTwitterUserId); if (blockUserResp != "") { return("User blocked successfully"); } else { return("Issue in user blocking"); } } catch (Exception ex) { _logger.LogError("user blocking" + ex.StackTrace); _logger.LogError("user blocking" + ex.Message); return("api issue while user blocking"); } }