class MetadataSyncDelegate {

    public boolean shouldStopSync( String metadataVersionSnapshot )
    {
        SystemInfo systemInfo = systemService.getSystemInfo();
        String systemVersion = systemInfo.getVersion();

        if ( StringUtils.isEmpty( systemVersion ) || !metadataSystemSettingService.getStopMetadataSyncSetting() )
        {
            return false;
        }

        ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream( metadataVersionSnapshot.getBytes( StandardCharsets.UTF_8 ) );
        String remoteVersion = "";

        try
        {
            JsonNode systemObject = renderService.getSystemObject( byteArrayInputStream, RenderFormat.JSON );

            if ( systemObject == null )
            {
                return false;
            }

            remoteVersion = systemObject.get( "version" ).textValue();

            if ( StringUtils.isEmpty( remoteVersion ) )
            {
                return false;
            }
        }
        catch ( IOException e )
        {
            log.error( "Exception occurred when parsing the metadata snapshot" + e.getMessage() );
        }

        return !systemVersion.trim().equals( remoteVersion.trim() );
    }

}