public boolean writeObject(Object object, String fileName) {
        if (fileName == null || fileName.isEmpty()) {
            throw new IllegalArgumentException("File name can't be null or empty!");
        }
        if (object == null) {
            throw new IllegalArgumentException("Object can't be null!");            
        }
        try {
            File file = new File(fileName);
            file.getParentFile().mkdirs();            
            FileOutputStream fileOut = new FileOutputStream(fileName);
            ObjectOutputStream out = new ObjectOutputStream(fileOut);
            out.writeObject(object);
            out.close();
            fileOut.close();
            return true;
        } catch (IOException ex) {
            return false;
        }
    }