final FileDescriptor fileDescriptor = FileManagerFactory.getFileManager().saveFile(filePath, filename, true, fileMetadata, inputStream);  final ParkingFile parkingFile = new ParkingFile(filename, filename, fileDescriptor .getMimeType(), fileDescriptor.getChecksum(), fileDescriptor.getChecksumAlgorithm(), fileDescriptor.getSize(), fileDescriptor.getUniqueId(), group);  new ParkingDocument(documentType, parkingFile, parkingRequest);
if(inputStream != null){ final Group group = getGroup(parkingRequest.getParkingParty().getParty()); final FileMetadata fileMetadata = new FileMetadata(filename, getParkingParty().getParty() .getName()); final FileDescriptor fileDescriptor = FileManagerFactory.getFileManager().saveFile(filePath, filename, true, fileMetadata, inputStream);  final ParkingFile parkingFile = new ParkingFile(filename, filename, fileDescriptor .getMimeType(), fileDescriptor.getChecksum(), fileDescriptor.getChecksumAlgorithm(), fileDescriptor.getSize(), fileDescriptor.getUniqueId(), group);  new ParkingDocument(documentType, parkingFile, parkingRequest); }
        protected void writeParkingFile(ParkingRequest parkingRequest, FilePath filePath,                String filename, ParkingDocumentType documentType, InputStream inputStream) {            final Group group = getGroup(parkingRequest.getParkingParty().getParty());            final FileMetadata fileMetadata = new FileMetadata(filename, getParkingParty().getParty()                    .getName());            String externalIdentifier = parkingRequest.getParkingFileExternalIdentifier(documentType);            if(externalIdentifier != null){                FileManagerFactory.getFileManager().deleteFile(externalIdentifier);            }            final FileDescriptor fileDescriptor = FileManagerFactory.getFileManager().saveFile(filePath,                    filename, true, fileMetadata, inputStream);            final ParkingFile parkingFile = new ParkingFile(filename, filename, fileDescriptor                    .getMimeType(), fileDescriptor.getChecksum(), fileDescriptor.getChecksumAlgorithm(),                    fileDescriptor.getSize(), fileDescriptor.getUniqueId(), group);            new ParkingDocument(documentType, parkingFile, parkingRequest);        }