public static function getPublicCalendar($container) {

		if (!$container instanceof ElggEntity) {
			return false;
		}

		$calendars = elgg_get_entities(array(
			'type' => 'object',
			'subtype' => Calendar::SUBTYPE,
			'container_guid' => $container->guid,
			'limit' => 1,
			'metadata_name_value_pairs' => array(
				'name' => '__public_calendar',
				'value' => true,
			),
			'order_by' => 'e.time_created ASC', // get the first one
		));

		return (empty($calendars)) ? Calendar::createPublicCalendar($container) : $calendars[0];
	}