private void addTemplate(
            Map<String, Map<PushNotificationType, TemplateGroup>> output,
            String templateName,
            Map<String, TemplateProperties> nameToTemplate,
            Map.Entry<String, Map<PushNotificationType, TemplateMappingProperties>> localeToTypeToPropertiesEntry,
            Map.Entry<PushNotificationType, TemplateMappingProperties> typeToPropertiesEntry,
            BiConsumer<TemplateGroup, Template> consumer) {
        if (StringUtil.isBlank(templateName)) {
            return;
        }
        TemplateProperties templateProperties = nameToTemplate.get(templateName);
        if (templateProperties == null) {
            throw new IllegalArgumentException(
                    "Could not find a template with the name: \""
                            + templateName
                            + "\"");
        }
        String template = templateProperties.getTemplate();
        if (StringUtil.isBlank(template)) {
            return;
        }
        Template t = TEMPLATE_ENGINE.buildTemplate(template);
        output.compute(localeToTypeToPropertiesEntry.getKey(), (key, typeToTemplateGroup) -> {
            if (typeToTemplateGroup == null) {
                typeToTemplateGroup = new FastEnumMap<>(PushNotificationType.class);
            }
            typeToTemplateGroup.compute(typeToPropertiesEntry.getKey(), (type, templateGroup) -> {
                if (templateGroup == null) {
                    templateGroup = new TemplateGroup();
                }
                consumer.accept(templateGroup, t);
                return templateGroup;
            });
            return typeToTemplateGroup;
        });
    }
@return {@link SendPushNotificationException} if the sender failed to send notifications no
        matter what reason
turms-plugins/turms-plugin-push/src/main/java/im/turms/plugin/push/core/PushNotificationSender.java