public function getDependencies(Model $model, $depth = 0) {
        $dependencies = array();

        if ($depth >= 5) {
            return $dependencies;
        }

        foreach (array($model->hasOne, $model->hasMany, $model->hasAndBelongsToMany) as $assocGroup) {
            foreach ($assocGroup as $alias => $assoc) {
                // hasOne, hasMany
                if (isset($assoc['dependent']) && $assoc['dependent']) {
                    $class = $assoc['className'];

                // hasAndBelongsToMany
                } else if (isset($assoc['joinTable'])) {
                    $class = $assoc['with'];

                } else {
                    continue;
                }

                $dependencies[] = array(
                    'alias' => $alias,
                    'model' => $class,
                    'dependencies' => $this->getDependencies($this->introspect($class), ($depth + 1))
                );
            }
        }

        return $dependencies;
    }