private async Task ExecuteAction(TweetsRefreshCommandContext tweetsRefreshCommandContext) { var sourceTweets = await _twitterClient.QueryAsync(new QueryModel(tweetsRefreshCommandContext.Tag, tweetsRefreshCommandContext.Count, tweetsRefreshCommandContext.ResultType)); var tweetsCollection = new TweetsCollection(tweetsRefreshCommandContext.Tag); foreach (var sourceTweet in sourceTweets) { var targetTweet = new Tweet(sourceTweet.Created_At, sourceTweet.Text); _pictureWorker.Do(targetTweet, sourceTweet.Extended_Entities); tweetsCollection.AddTweet(targetTweet); } if (!tweetsRefreshCommandContext.IsSaveHistory) { await _tweetsCollectionRepository.RemoveAll(); } _tweetsCollectionRepository.Insert(tweetsCollection); await _unitOfWork.SaveAsync(); }