class FirmwareManagementService extends AbstractService {

    public void handleSsldPendingFirmwareUpdate(final String deviceIdentification) {

        final List<SsldPendingFirmwareUpdate> ssldPendingFirmwareUpdates = this.ssldPendingFirmwareUpdateRepository
                .findByDeviceIdentification(deviceIdentification);

        if (CollectionUtils.isEmpty(ssldPendingFirmwareUpdates)) {
            return;
        }

        /*
         * A pending firmware update record was stored for this device earlier.
         * This means this method is probably called following a firmware
         * update. Retrieve the firmware version from the device to have the
         * current version that is installed available.
         *
         * If multiple pending update records exist, it is not really clear what
         * to do. The following approach assumes the most recently created one
         * is relevant, and other pending records are out-dated.
         */
        final SsldPendingFirmwareUpdate ssldPendingFirmwareUpdate;
        if (ssldPendingFirmwareUpdates.size() == 1) {
            ssldPendingFirmwareUpdate = ssldPendingFirmwareUpdates.get(0);
        } else {
            LOGGER.warn("Found multiple pending firmware update records for SSLD: {}", ssldPendingFirmwareUpdates);
            ssldPendingFirmwareUpdate = this.getMostRecentSsldPendingFirmwareUpdate(ssldPendingFirmwareUpdates)
                    .orElseThrow(
                            () -> new AssertionError("No most recent pending firmware update from a non-empty list"));
            this.deleteOutdatedSsldPendingFirmwareUpdates(ssldPendingFirmwareUpdates, ssldPendingFirmwareUpdate);
        }

        final String organisationIdentification = ssldPendingFirmwareUpdate.getOrganisationIdentification();
        final String correlationUid = ssldPendingFirmwareUpdate.getCorrelationUid();

        LOGGER.info(
                "Handling SSLD pending firmware update for device identification: {}, organisation identification: {} and correlation UID: {}.",
                deviceIdentification, organisationIdentification, correlationUid);

        try {
            final int messagePriority = MessagePriorityEnum.DEFAULT.getPriority();
            this.getFirmwareVersion(organisationIdentification, deviceIdentification, correlationUid,
                    DeviceFunction.GET_FIRMWARE_VERSION.name(), messagePriority, this.getFirmwareVersionDelay);
        } catch (final FunctionalException e) {
            LOGGER.error("Caught exception when calling get firmware version", e);
        }
    }

    public  FirmwareManagementService();

}