public async Task RetweetHandler(int id)
        {
            ClaimsPrincipal user   = _iHttpContextAccessor.HttpContext.User;
            int             userID = int.Parse(ClaimExtensions.GetUserId(user));

            var tweet = await _dbContext.Tweets.Where(p => p.Id == id).Select(p =>
                                                                              new TweetEntity()
            {
                Id           = p.Id,
                Content      = p.Content,
                CreatedAt    = p.CreatedAt,
                CreatorId    = p.CreatorId,
                LikeCount    = p.LikeCount,
                RetweetCount = p.RetweetCount,
                IsRetweet    = p.IsRetweet,
            }).SingleOrDefaultAsync();

            if (tweet is null)
            {
                throw new TwitterApiException(400, "Invalid tweet id");
            }
            tweet.RetweetCount++;

            _dbContext.Tweets.Update(tweet);
            await _dbContext.SaveChangesAsync();

            var relation = new UserTweetRelationEntity();

            relation.TweetId = tweet.Id;
            relation.UserId  = userID;
            await _dbContext.UserTweetRelations.AddRangeAsync(relation);

            await _dbContext.SaveChangesAsync();

            var relationn = new TweetRetweeterRelationEntity();

            relationn.TweetId     = tweet.Id;
            relationn.RetweeterId = userID;
            await _dbContext.TweetRetweeterRelations.AddRangeAsync(relationn);

            await _dbContext.SaveChangesAsync();

            var activityLog = new ActivityLogEntity()
            {
                ActorId        = userID,
                ActorName      = user.Identity.Name,
                ActionTypeId   = (int)ActionLogEnums.Retweet,
                ActionTypeName = "Retweet",
                TargetTweetId  = tweet.Id,
                TargetUserId   = tweet.CreatorId,
                Date           = DateTime.Now,
            };

            await _dbContext.ActivityLogs.AddAsync(activityLog);

            await _dbContext.SaveChangesAsync();
        }
        public async Task AddTweetHandler(AddTweetDto request)
        {
            ClaimsPrincipal user      = _iHttpContextAccessor.HttpContext.User;
            int             creatorID = int.Parse(ClaimExtensions.GetUserId(user));

            var newTweet = new TweetEntity()
            {
                Content      = request.Content,
                CreatedAt    = DateTime.Now,
                CreatorId    = creatorID,
                LikeCount    = 0,
                RetweetCount = 0,
                IsRetweet    = false,
            };

            await _dbContext.Tweets.AddAsync(newTweet);

            await _dbContext.SaveChangesAsync();

            if (request.HashTags != null && request.HashTags.Count > 0)
            {
                var list = new List <TweetHashtagRelationEntity>();
                foreach (var hashtag in request.HashTags)
                {
                    var tag = await searchHashtag(hashtag);

                    if (tag is null)
                    {
                        tag            = new HashtagEntity();
                        tag.Content    = hashtag.Content.ToLower();
                        tag.UsageCount = 1;
                        await _dbContext.Hashtags.AddAsync(tag);

                        await _dbContext.SaveChangesAsync();
                    }
                    else
                    {
                        tag.UsageCount++;
                        _dbContext.Hashtags.Update(tag);
                        await _dbContext.SaveChangesAsync();
                    }

                    var relationht = new HashtagTweetRelationEntity();
                    relationht.HashtagId = tag.Id;
                    relationht.TweetId   = newTweet.Id;
                    await _dbContext.HashtagTweetRelations.AddAsync(relationht);

                    await _dbContext.SaveChangesAsync();


                    list.Add(new TweetHashtagRelationEntity()
                    {
                        TweetId   = newTweet.Id,
                        HashtagId = tag.Id,
                    });
                }
                await _dbContext.TweetHashtagRelations.AddRangeAsync(list);
            }
            await _dbContext.SaveChangesAsync();

            var relationtu = new UserTweetRelationEntity();

            relationtu.TweetId = newTweet.Id;
            relationtu.UserId  = creatorID;
            await _dbContext.UserTweetRelations.AddRangeAsync(relationtu);

            await _dbContext.SaveChangesAsync();
        }