class DefaultMetadataVersionService implements MetadataVersionService {

    @Override
    @Transactional
    public void createMetadataVersionInDataStore( String versionName, String versionSnapshot )
    {
        if ( StringUtils.isEmpty( versionSnapshot ) )
        {
            throw new MetadataVersionServiceException( "The Metadata Snapshot is null while trying to create a Metadata Version entry in DataStore." );
        }

        KeyJsonValue keyJsonValue = new KeyJsonValue();
        keyJsonValue.setKey( versionName );
        keyJsonValue.setNamespace( MetadataVersionService.METADATASTORE );

        //MetadataWrapper is used to avoid Metadata keys reordering by jsonb (jsonb does not preserve keys order)
        keyJsonValue.setValue( renderService.toJsonAsString( new MetadataWrapper( versionSnapshot ) ) );

        try
        {
            metaDataKeyJsonService.addMetaDataKeyJsonValue( keyJsonValue );

        }
        catch ( Exception ex )
        {
            String message = "Exception occurred while saving the Metadata snapshot in Data Store" + ex.getMessage();
            log.error( message, ex );
            throw new MetadataVersionServiceException( message, ex );
        }
    }

    public  DefaultMetadataVersionService( MetadataVersionStore metadataVersionStore,
        MetadataExportService metadataExportService, MetadataKeyJsonService metaDataKeyJsonService,
        NodeService nodeService, MetadataSystemSettingService metadataSystemSettingService,
        RenderService renderService );

}