public static function toAssociative($array, $recursive = false) {
        $associative = new AssociativeArray();

        foreach($array as $key => $value) {
            if ($recursive && is_array($value)) {
                $associative[$key] = self::toAssociative($value, true);
            } else {
                $associative[$key] = $value;
            }
        }

        return $associative;

    }