public function sanitize($value, $mode = null)
    {
        if ($mode === null) {
            $mode = $this->sanitize;
        }
        if (is_array($value)) {
            $hash = md5(json_encode($value));
            /* Optimize lazy loading */
            if (isset(static::$_sanitizeCache[$hash])) {
                return static::$_sanitizeCache[$hash];
            }

            return static::$_sanitizeCache[$hash] =
                ArrayHelper::map(
                    $value,
                    function ($value) use ($mode) {
                        return $this->sanitizeValue($value, $mode);
                    },
                    true
                );
        }

        return $this->sanitizeValue($value, $mode);
    }