function createMetadataProfile($version, $versionToXsdMap)
{
    $metadataProfile = new MetadataProfile();
    $metadataProfile->setPartnerId(99);
    $metadataProfile->setStatus(MetadataProfile::STATUS_ACTIVE);
    $metadataProfile->setName('Tvinci ingest v' . $version);
    $metadataProfile->setSystemName('TvinciIngestV' . $version);
    $metadataProfile->setDescription('Tvinci ingest schema version ' . $version);
    $metadataProfile->setObjectType(MetadataObjectType::ENTRY);
    $metadataProfile->setRequiredCopyTemplatePermissions(FEATURE_TVINCI_INGEST_BASE . $version);
    $metadataProfile->save();
    $xsdData = $versionToXsdMap[$version];
    $key = $metadataProfile->getSyncKey(MetadataProfile::FILE_SYNC_METADATA_DEFINITION);
    kFileSyncUtils::file_put_contents($key, $xsdData);
    kMetadataManager::parseProfileSearchFields($metadataProfile->getPartnerId(), $metadataProfile);
}
function createMetadataProfile()
{
    $metadataProfile = new MetadataProfile();
    $metadataProfile->setPartnerId(99);
    $metadataProfile->setStatus(MetadataProfile::STATUS_ACTIVE);
    $metadataProfile->setName('Live Stream Monitoring');
    $metadataProfile->setSystemName('LiveMonitor');
    $metadataProfile->setDescription('Email notification flag indicating a 24/7 live-entry should be monitored.');
    $metadataProfile->setObjectType(MetadataObjectType::ENTRY);
    $metadataProfile->setRequiredCopyTemplatePermissions(FEATURE_KALTURA_LIVE_MONITOR);
    $metadataProfile->save();
    $xsdData = '<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
	<xsd:element name="metadata">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element name="Monitor" minOccurs="1" maxOccurs="1">
					<xsd:annotation>
						<xsd:documentation></xsd:documentation>
						<xsd:appinfo>
							<label>Monitor 24/7</label>
							<key>monitor</key>
							<searchable>true</searchable>
							<description>Send E-mail notification if live-stream broadcast stopped</description>
						</xsd:appinfo>
					</xsd:annotation>
					<xsd:simpleType>
						<xsd:restriction base="listType">
							<xsd:enumeration value="on"/>
							<xsd:enumeration value="off"/>
						</xsd:restriction>
					</xsd:simpleType>
				</xsd:element>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>
	<xsd:simpleType name="listType">
		<xsd:restriction base="xsd:string"/>
	</xsd:simpleType>
</xsd:schema>';
    $key = $metadataProfile->getSyncKey(MetadataProfile::FILE_SYNC_METADATA_DEFINITION);
    kFileSyncUtils::file_put_contents($key, $xsdData);
    kMetadataManager::parseProfileSearchFields($metadataProfile->getPartnerId(), $metadataProfile);
}