protected static function serializeHandlers()
    {
        $hooks = (array) self::getTask()->handlers;
        foreach ($hooks as &$handlers) {
            foreach (array_keys($handlers) as $key) {
                self::toggleSerializeClosure($handlers, $key);
            }
        }

        return $hooks;
    }