def _build_entity_mappings(module_entity_map: Dict[str, dict]) -> tuple[dict, dict]:
    """Build mappings from class names and entity names to entity IDs.

    Args:
        module_entity_map: Mapping of module names to their entity details

    Returns:
        tuple: (entity_class_to_id_map, entity_name_to_id_map)
    """
    # Create a reverse mapping from class name to entity ID
    entity_class_to_id_map = {}
    # Create a mapping from entity name to entity ID
    entity_name_to_id_map = {}

    for module_info in module_entity_map.values():
        for i, name in enumerate(module_info.get("entity_names", [])):
            if i < len(module_info.get("entity_ids", [])):
                if name not in entity_name_to_id_map:
                    entity_name_to_id_map[name] = []
                entity_name_to_id_map[name].append(module_info["entity_ids"][i])

        for i, class_name in enumerate(module_info.get("entity_classes", [])):
            entity_name = module_info["entity_names"][i]
            # Find the entity ID for this class
            for entity_id in module_info.get("entity_ids", []):
                if (
                    entity_name
                    == module_info["entity_names"][module_info["entity_classes"].index(class_name)]
                ):
                    if class_name not in entity_class_to_id_map:
                        entity_class_to_id_map[class_name] = []
                    entity_class_to_id_map[class_name].append(entity_id)

    return entity_class_to_id_map, entity_name_to_id_map
Build mappings from class names and entity names to entity IDs.

    Args:
        module_entity_map: Mapping of module names to their entity details

    Returns:
        tuple: (entity_class_to_id_map, entity_name_to_id_map)
    
backend/airweave/platform/db_sync.py