protected function addUnique(Collection $collection, Entity $newItem, $uniqueField = null)
	{
		if ($collection->contains($newItem)) {
			return false;
		}

		if (is_null($uniqueField)) {
			$collection->add($newItem);
		} else {
			$indexBy = $newItem->getProperty($uniqueField);

			if ($collection->offsetExists($indexBy)) {
				throw new \RuntimeException("Cannot add value '{$newItem}' to '{$this}': element by {$uniqueField}={$indexBy} already exists in the collection");
			}

			$collection->set($indexBy, $newItem);
		}

		return true;
	}