@Override
    public void perform(ISConnection connection, Map<String, String> params) {
        List<String> keys = new ArrayList<String>();
        keys.add("folder");
        keys.add("file");
        keys.add("nazev");
        keys.add("popis");
        keys.add("njmeno");
        keys.add("opt");

        boolean failed = false;
        for(String key:keys) {
            if (params.get(key) == null) {
                System.out.println("The -D" + key + " Additional parameter is not specified.");
                failed = true;
            }
        }

        if (!params.get("opt").equals("er") &&  !params.get("opt").equals("wr") && !params.get("opt").equals("re")) {
            System.out.println("The -Dopt Additional parameter must be 'er', 'wr' or 're'");
            failed = true;
        }

        File file = null;
        if (params.get("file") != null) {
            file = new File(params.get("file"));
            if (!file.exists()) {
                System.out.println("File '" + params.get("file") + "' does not exist.");
                failed = true;
            }
        }

        if (failed) {
            return;
        }

        String magicNumber;

        HttpPost openForm = OpenForm();
        String form = connection.performRequest(openForm);
        magicNumber = ISConnection.ExtractMagicNumber(form);
        HttpPost sendFile = SendFile(params.get("folder"),
                file,
                params.get("nazev"),
                params.get("popis"),
                params.get("njmeno"),
                params.get("opt"),
                magicNumber);
        String status = connection.performRequest(sendFile);
        String msg = ISConnection.ExtractMessage(status);
        if (msg != null) {
            System.out.println(msg);
        } else {
            System.out.println("Processing finished. Could not parse status message.");
            CLI.ExitWithDisclaimer();
        }
    }