Refactored a helper method to convert an array to CommentData.