public void save() {
        try {
            if (getSize() == 0) {
                if ((file.exists()) && (!file.delete())) {
                    throw new DataBaseException("Cannot delete a file!");
                }
                deletePath();
            } else {
                createPath();
                if (!file.exists()) {
                    if (!file.createNewFile()) {
                        throw new DataBaseException("Cannot create a file " + fileName);
                    }
                }
                try (RandomAccessFile outputFile = new RandomAccessFile(fileName, "rw")) {
                    for (Map.Entry<String, String> node : old.entrySet()) {
                        outputFile.writeInt(node.getKey().getBytes(StandardCharsets.UTF_8).length);
                        outputFile.writeInt(node.getValue().getBytes(StandardCharsets.UTF_8).length);
                        outputFile.write(node.getKey().getBytes(StandardCharsets.UTF_8));
                        outputFile.write(node.getValue().getBytes(StandardCharsets.UTF_8));
                    }
                    outputFile.setLength(outputFile.getFilePointer());
                }
            }
        } catch (FileNotFoundException e) {
            throw new DataBaseException("File save error!");
        } catch (IOException e) {
            throw new DataBaseException("Write to file error!");
        }
    }