processPost = async (req, res, next) => {
  const { content, communityName } = req.body;
  const { serviceProvider, timeout } = await getSystemPreferences();

  try {
    if (serviceProvider === "disabled") {
      req.failedDetection = false;
      return next();
    }

    const categoryFilterService = createCategoryFilterService(serviceProvider);

    const categories = await categoryFilterService.getCategories(
      content,
      timeout
    );

    if (Object.keys(categories).length > 0) {
      const recommendedCommunity = Object.keys(categories)[0];

      if (recommendedCommunity !== communityName) {
        const type = "categoryMismatch";
        const info = {
          community: communityName,
          recommendedCommunity,
        };

        return res.status(403).json({ type, info });
      } else {
        req.failedDetection = false;
        next();
      }
    } else {
      req.failedDetection = true;
      next();
    }
  } catch (error) {
    const errorMessage = `Error processing post: ${error.message}`;
    await saveLogInfo(null, errorMessage, serviceProvider, "error");
    return res.status(500).json({ message: "Error processing post" });
  }
}
@param next - confirmPost (/middlewares/post/confirmPost.js)