public static function delete_template($id, $deleteplans = true) {
        $params = self::validate_parameters(self::delete_template_parameters(), array(
            'id' => $id,
            'deleteplans' => $deleteplans,
        ));

        $template = api::read_template($params['id']);
        self::validate_context($template->get_context());

        return api::delete_template($params['id'], $params['deleteplans']);
    }