public void addRecord(String data) throws Exception {
        Record rec = new Record(data);
        if (isNameExists(rec.name)) {
            remove(rec.name);
            throw new Exception("This name already exists.");
        }
        String content = "";
        String lineSeparator = System.getProperty("line.separator");   // перевод на след. строку в
        StringTokenizer str = new StringTokenizer(rec.toString());
        while (str.hasMoreTokens()) {
            content += str.nextToken() + lineSeparator;
        }

        FileWriter fw = new FileWriter(file, true);
        BufferedWriter bw = new BufferedWriter(fw);
        bw.write(content);
        bw.close();


    }