class MetadataSyncImportHandler {

    public MetadataSyncSummary importMetadata( MetadataSyncParams syncParams, String versionSnapShot )
    {
        MetadataVersion version = getMetadataVersion( syncParams );
        MetadataImportParams importParams = syncParams.getImportParams();
        MetadataSyncSummary metadataSyncSummary = new MetadataSyncSummary();

        if ( importParams == null )
        {
            throw new MetadataSyncServiceException( "MetadataImportParams for the Sync cant be null." );
        }

        Map<Class<? extends IdentifiableObject>, List<IdentifiableObject>> classListMap = parseClassListMap(
            versionSnapShot );

        if ( classListMap == null )
        {
            throw new MetadataSyncServiceException( "ClassListMap can't be null" );
        }

        // Job configurations should not be imported from any source
        // (neither by normal metadata import nor by sync).
        classListMap.remove( JobConfiguration.class );
        importParams.setObjects( classListMap );

        ImportReport importReport = null;

        try
        {
            importReport = metadataImportService.importMetadata( importParams );

        }
        catch ( Exception e )
        {
            String message = "Exception occurred while trying to import the metadata. " + e.getMessage();
            log.error( message,e );
            throw new MetadataSyncImportException( message,e );
        }

        boolean addNewVersion = handleImportReport( importReport, version );

        if ( addNewVersion )
        {
            try
            {
                metadataVersionDelegate.addNewMetadataVersion( version );
            }
            catch ( MetadataVersionServiceException e )
            {
                throw new MetadataSyncServiceException( e.getMessage(), e );
            }

        }

        metadataSyncSummary.setImportReport( importReport );
        metadataSyncSummary.setMetadataVersion( version );

        return metadataSyncSummary;
    }

}