class BpmnInstaller {

    protected HttpEntity buildMimeMultipart(String bpmnFileName, String version) throws IOException {
        FileInputStream bpmnFileStream = new FileInputStream(
                Paths.get(getMsoConfigPath(), "ASDC", version, bpmnFileName).normalize().toString());

        byte[] bytesToSend = IOUtils.toByteArray(bpmnFileStream);
        HttpEntity requestEntity =
                MultipartEntityBuilder.create()
                        .addPart(FormBodyPartBuilder.create().setName("deployment-name")
                                .setBody(new StringBody("MSO Sample 1", ContentType.TEXT_PLAIN))
                                .setField("Content-Disposition",
                                        String.format("form-data; name=\"%s\"", "deployment-name"))
                                .build())
                        .addPart(FormBodyPartBuilder.create().setName("enable-duplicate-filtering")
                                .setBody(new StringBody("false", ContentType.TEXT_PLAIN))
                                .setField("Content-Disposition",
                                        String.format("form-data; name=\"%s\"", "enable-duplicate-filtering"))
                                .build())
                        .addPart(FormBodyPartBuilder.create().setName("deplpy-changed-only")
                                .setBody(new StringBody("false", ContentType.TEXT_PLAIN))
                                .setField("Content-Disposition",
                                        String.format("form-data; name=\"%s\"", "deploy-changed-only"))
                                .build())
                        .addPart(FormBodyPartBuilder.create().setName("deployment-source")
                                .setBody(new StringBody("local", ContentType.TEXT_PLAIN))
                                .setField("Content-Disposition",
                                        String.format("form-data; name=\"%s\"", "deployment-source"))
                                .build())
                        .addPart(
                                FormBodyPartBuilder.create().setName(bpmnFileName)
                                        .setBody(new ByteArrayBody(bytesToSend, ContentType.create("octet"),
                                                bpmnFileName))
                                        .setField("Content-Disposition",
                                                String.format("form-data; name=\"%s\"; filename=\"%s\"; size=%d",
                                                        bpmnFileName, bpmnFileName, bytesToSend.length))
                                        .build())
                        .build();

        IOUtils.closeQuietly(bpmnFileStream);
        return requestEntity;
    }

}