private static function traverse(
        $deep,
        &$object,
        $mapFunction,
        $seen = array()
    ) {
        if ($object instanceof AVObject)
        {
            if (in_array($object, $seen, true))
            {
                return null;
            }
            $seen[] = $object;
            if ($deep)
            {
                self::traverse($deep, $object->estimatedData, $mapFunction, $seen);
            }

            return $mapFunction($object);
        }
        if ($object instanceof AVRelation || $object instanceof AVFile)
        {
            return $mapFunction($object);
        }
        if (is_array($object))
        {
            foreach ($object as $key => $value)
            {
                self::traverse($deep, $value, $mapFunction, $seen);
            }

            return $mapFunction($object);
        }

        return $mapFunction($object);
    }