public function toObject() {

		$options = $this->getOptions();
		$result = (object) [
			'type' => 'list',
			'count' => $this->getCount(),
			'limit' => elgg_extract('limit', $options, elgg_get_config('default_limit')),
			'offset' => elgg_extract('offset', $options, 0),
			'sorts' => $this->sorts,
			'filters' => array_map(function($e) {
				return [
					'filter' => $e['filter'],
					'target' => $e['target'] ? $e['target']->guid : 0,
				];
			}, $this->fiilters),
			'items' => [],
		];

		$entities = new ElggBatch($this->getter, $options);
		foreach ($entities as $entity) {
			if (is_object($entity) && is_callable([$entity, 'toObject'])) {
				$result->items[] = $entity->toObject();
			} else {
				$result->items[] = $entity;
			}
		}

		return $result;
	}