public static int createFamily(int leaderId) {
        try {
            Connection con = DatabaseConnection.getConnection();

            int ret;
            try (PreparedStatement ps = con.prepareStatement("INSERT INTO families (`leaderid`) VALUES (?)", Statement.RETURN_GENERATED_KEYS)) {
                ps.setInt(1, leaderId);
                ps.executeUpdate();
                try (ResultSet rs = ps.getGeneratedKeys()) {
                    if (!rs.next()) {
                        rs.close();
                        ps.close();
                        return 0;
                    }   ret = rs.getInt(1);
                }
            }
            return ret;
        } catch (SQLException e) {
            return 0;
        }
    }