public static function countRelatedElements(Model $model, $type=null)
	{
		if($model->getType() == $model::TYPE_START) {
			if($type === null) {
				$column = 'bootstrap_parentId';
				$values = $model->id;
			}
			else {
				$column = array('bootstrap_parentId=?', 'type=?');
				$values = array($model->id, $model->getTypeName($type));
			}
		}
		elseif($type === null) {
			$column = array('id !=?', '(bootstrap_parentId=? OR id=?)');
			$values = array($model->id, $model->bootstrap_parentId, $model->bootstrap_parentId);
		}
		elseif($type == $model::TYPE_START) {
			$column = 'id';
			$values = $model->bootstrap_parentId;
		}
		else {
			$column = array('id !=?', 'bootstrap_parentId=?', 'type=?');
			$values = array($model->id, $model->bootstrap_parentId, $model->getTypeName($type));

		}

		return \ContentModel::countBy($column, $values);
	}