class SpiAspspConsentDataProviderImpl implements SpiAspspConsentDataProvider {

    @Override
    public void updateAspspConsentData(@Nullable byte[] aspspConsentData) {
        if (Arrays.equals(nullToEmpty(aspspConsentData), lastKnownData)) {
            // Do nothing if nothing changed
            return;
        }
        if (aspspConsentData == null || Arrays.equals(EMPTY_BYTE_ARRAY, aspspConsentData)) {
            clearAspspConsentData();
            return;
        }

        aspspDataService.updateAspspConsentData(new AspspConsentData(aspspConsentData, encryptedConsentId));
        lastKnownData = aspspConsentData;
    }

}