class NotificationManager {

    @Transactional(propagation = Propagation.REQUIRED)
    public void notifyIssueComment(IssueComment comment, Issue issue, String htmlText) {
        NotificationSettings newIssueCommentSettings = notificationSettingsManager
                .load(NotificationType.NEW_ISSUE_COMMENT);
        if (newIssueCommentSettings == null || !newIssueCommentSettings.isEnabled()) {
            LOGGER.info(messageHelper.getMessage(MessageConstants.INFO_NOTIFICATION_TEMPLATE_NOT_CONFIGURED,
                    "new issue"));
            return;
        }

        NotificationMessage message = new NotificationMessage();
        message.setTemplate(new NotificationTemplate(newIssueCommentSettings.getTemplateId()));

        AbstractSecuredEntity entity = entityManager.load(issue.getEntity().getEntityClass(),
                                                          issue.getEntity().getEntityId());
        List<PipelineUser> referencedUsers = userManager.loadUsersByNames(Arrays.asList(entity.getOwner(),
                                                                                        issue.getAuthor()));
        List<Long> ccUserIds = getMentionedUsers(comment.getText());
        referencedUsers.stream()
            .filter(u -> u.getUserName().equals(entity.getOwner()))
            .findFirst()
            .ifPresent(owner -> ccUserIds.add(owner.getId()));

        message.setCopyUserIds(ccUserIds);

        if (newIssueCommentSettings.isKeepInformedOwner()) {
            PipelineUser author = referencedUsers.stream()
                .filter(u -> u.getUserName().equals(issue.getAuthor()))
                .findFirst()
                .orElseThrow(() -> new IllegalArgumentException("No issue author was found"));
            message.setToUserId(author.getId());
        }

        IssueComment copyWithHtml = comment.toBuilder().text(htmlText).build();

        Map<String, Object> commentParams = jsonMapper.convertValue(copyWithHtml,
                                                                    new TypeReference<Map<String, Object>>() {});
        commentParams.put("issue", jsonMapper.convertValue(issue, new TypeReference<Map<String, Object>>() {}));
        message.setTemplateParameters(commentParams);

        monitoringNotificationDao.createMonitoringNotification(message);
    }

}