class MetadataVersionDelegate {

    public List<MetadataVersion> getMetaDataDifference( MetadataVersion metadataVersion )
    {
        String url;
        List<MetadataVersion> metadataVersions = new ArrayList<>();
        
        if ( metadataVersion == null )
        {
            url = metadataSystemSettingService.getEntireVersionHistory();
        }
        else
        {
            url = metadataSystemSettingService.getMetaDataDifferenceURL( metadataVersion.getName() );
        }

        DhisHttpResponse dhisHttpResponse = getDhisHttpResponse( url, VERSION_TIMEOUT );

        if ( isValidDhisHttpResponse( dhisHttpResponse ) )
        {
            try
            {
                metadataVersions = renderService
                    .fromMetadataVersion( new ByteArrayInputStream( dhisHttpResponse.getResponse().getBytes() ),
                        RenderFormat.JSON );
                return metadataVersions;
            }
            catch ( IOException io )
            {
                String message =
                    "Exception occurred while trying to do JSON conversion. Caused by:  " + io.getMessage();
                log.error( message, io );
                throw new MetadataVersionServiceException( message, io );
            }
        }

        log.warn( "Returning empty for the metadata versions difference" );
        return metadataVersions;
    }

    public  MetadataVersionDelegate( DefaultMetadataSystemSettingService metadataSystemSettingService,
        SynchronizationManager synchronizationManager, RenderService renderService,
        MetadataVersionService metadataVersionService );

}