public static function delete_category(category_controller $category) : bool {
        $event = category_deleted::create_from_object($category);

        // Delete all fields.
        foreach ($category->get_fields() as $field) {
            self::delete_field_configuration($field);
        }

        $result = $category->delete();
        $event->trigger();
        return $result;
    }