public void TryToRemoveSpamComment(List<Post> posts, Comment comment, Post post, int postNum) { try { if (comment.ContainsSpam()) RemoveCommentWithLogging(post, postNum, posts.Count, comment); } catch (Exception ex) { log(postNum, posts.Count, post.Name, Comment.TotalCommentsRemoved, Comment.TotalComments, "Failed to remove comment: " + ex.Message); } }
private void RemoveCommentWithLogging(Post post, int postNum, int numberOfPosts, Comment comment) { log(postNum, numberOfPosts, post.Name, Comment.TotalCommentsRemoved, Comment.TotalComments, comment.Content); comment.Remove(); }