public function createCollection(array &$data = null, $primaryId = null) {
		$collectionClass = $this->getCollectionClass();
		$modelClass      = $this->getModelClass();
		
		if ($primaryId === null) {
			$primaryId = $this->getPrimaryName();
		}

		// Primary ID data handling
		if (! empty($data) || $primaryId !== null) {
			$validation = true;

			array_walk($data, function(&$item) use($primaryId, &$validation) {
				if (! isset($item[$primaryId])) {
					$validation = false;
				}
			});

			if ($validation) {
				array_walk($data, function(&$item) use($primaryId) {
					if (is_object($item[$primaryId])) {
						$item[$primaryId] = (string) $item[$primaryId];
					}
				});
			} else {
				$primaryId = null;
			}
		}

		// Creating and supplying of the dependencies
		$collection = $collectionClass::factory($data, $modelClass, $primaryId);
		$collection->setDatagate($this);

		if ($this->hasLocator()) {
			$collection->setLocator($this->getLocator());
		}

		return $collection;
	}