public function filter($collection) { $result = []; $this->recurse($result, $collection); return $result; }