public static Integer getUniqueId() {
        Integer result = null;
        ResultSet rs = null;
        PreparedStatement ps = null;

        try {
            con = ConnectionManager.getConnection();
            if (con == null){
                return null;
            }
            String sql = "SELECT max(id) + 1 FROM office_object";
            ps = con.prepareStatement(sql);
            rs = ps.executeQuery();
            if (rs.next()){
                result = rs.getInt(1);
            }
            con.close();
        } catch (SQLException e) {
            e.printStackTrace();
            logger.error("SQL query execution errors. Error: " + e.getSQLState() + " | " + e.getErrorCode());
        } finally {
            try {
                if (ps != null)
                    ps.close();
                if (rs != null)
                    rs.close();
            } catch (Exception e){
                logger.warn("Connection was closed with errors.");
            }
        }
        return result;
    }