private async Task <List <PostWithDetailsDto> > FilterPostsByTag(List <PostWithDetailsDto> allPostDtos, Tag tag) { var filteredPostDtos = new List <PostWithDetailsDto>(); foreach (var postDto in allPostDtos) { if (await _postTagRepository.FindByTagIdAndPostIdAsync(postDto.Id, tag.Id) == null) { continue; } filteredPostDtos.Add(postDto); } return(filteredPostDtos); }