class FirmwareManagementService extends AbstractService {

    public void tryToAddDeviceFirmwareFile(final String deviceIdentification,
            final List<FirmwareVersion> firmwareVersionsNotCurrent) {

        if (firmwareVersionsNotCurrent.isEmpty()) {
            LOGGER.info("No firmware to look for, concerning device {}, so nothing to add.", deviceIdentification);
            return;
        }

        final Device device = this.deviceRepository.findByDeviceIdentification(deviceIdentification);

        // check each file for the module and the version as returned by the
        // device, in theory there could be files that have partially
        // overlapping modules,
        // therefore we check if all modules are in the file

        for (final FirmwareFile file : this.getAvailableFirmwareFilesForDeviceModel(device.getDeviceModel())) {
            if (firmwareFileContainsAllOfTheseModules(file, firmwareVersionsNotCurrent)) {
                // file found, insert a record into the history
                final DeviceFirmwareFile deviceFirmwareFile = new DeviceFirmwareFile(device, file, new Date(),
                        INSTALLER);
                this.deviceFirmwareFileRepository.save(deviceFirmwareFile);

                if (LOGGER.isInfoEnabled()) {
                    LOGGER.info(
                            "Added new record to deviceFirmwareFile for device: {} with following modules (ModulesType/Versions):{} " + ", using file: {}",
                            deviceIdentification, firmwareVersionsNotCurrent.toString(), file.getFilename());
                }
                return;
            }
        }

        LOGGER.warn("Could not find any firmware file for device: {} that contains (all of) the following modules (ModulesType/Versions):{}",
                deviceIdentification, firmwareVersionsNotCurrent);
    }

    public  FirmwareManagementService();

}