public void save(){
        if (this.getId() != null){
            try {
                PreparedStatement preparedStatement = Organization.connection.prepareStatement(
                        selectSQL,
                        ResultSet.TYPE_FORWARD_ONLY,
                        ResultSet.CONCUR_UPDATABLE
                );
                preparedStatement.setInt(1, this.getId());
                ResultSet resultSet = preparedStatement.executeQuery();
                if(resultSet.next()){
                    resultSet.updateString("name", this.getName());
                    resultSet.updateString("ogrn", this.getOgrn());
                    resultSet.updateString("phone", this.getPhone());
                    resultSet.updateString("okato", this.getOkato());
                    resultSet.updateString("namef", this.getNamef());
                    resultSet.updateString("postal_index", this.getPostal_index());
                    resultSet.updateString("address", this.getAddress().getCode());
                    resultSet.updateString("address_house", this.getAddress().getHouse());
                    resultSet.updateString("dir_last_name", this.getDirLastName());
                    resultSet.updateString("dir_middle_name", this.getDirMiddleName());
                    resultSet.updateString("dir_first_name", this.getDirFirstName());
                    resultSet.updateString("acc_last_name", this.getAccLastName());
                    resultSet.updateString("acc_middle_name", this.getAccMiddleName());
                    resultSet.updateString("acc_first_name", this.getAccFirstName());
                    resultSet.updateString("fax", this.getFax());
                    resultSet.updateString("email", this.getEmail());
                    resultSet.updateDate("date_e", new java.sql.Date(this.getDateE().getTime()));
                    resultSet.updateDate("date_b", new java.sql.Date(this.getDateB().getTime()));
                    resultSet.updateInt("code", this.getCode());
                    resultSet.updateString("msg", this.getMsg());
                    resultSet.updateInt("l_fed", this.getlFed());
                    resultSet.updateInt("l_reg", this.getlReg());
                    resultSet.updateInt("l_dor", this.getlDor());
                    resultSet.updateRow();
                }
            } catch (SQLException e) {
                e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
            }
        } else {
            try {
                PreparedStatement preparedStatement = Organization.connection.prepareStatement(
                        insertSQL,
                        Statement.RETURN_GENERATED_KEYS
                );
                preparedStatement.setString(1, this.getName());
                preparedStatement.setString(2, this.getOgrn());
                preparedStatement.setString(3, this.getPhone());
                preparedStatement.setString(4, this.getOkato());
                preparedStatement.setString(5, this.getNamef());
                preparedStatement.setString(6, this.getPostal_index());
                preparedStatement.setString(7, this.getAddress().getCode());
                preparedStatement.setString(8, this.getAddress().getHouse());
                preparedStatement.setString(9, this.getDirLastName());
                preparedStatement.setString(10, this.getDirMiddleName());
                preparedStatement.setString(11, this.getDirFirstName());
                preparedStatement.setString(12, this.getAccLastName());
                preparedStatement.setString(13, this.getAccMiddleName());
                preparedStatement.setString(14, this.getAccFirstName());
                preparedStatement.setString(15, this.getFax());
                preparedStatement.setString(16, this.getEmail());
                preparedStatement.setDate(17, new java.sql.Date(this.getDateE().getTime()));
                preparedStatement.setDate(18, new java.sql.Date(this.getDateB().getTime()));
                preparedStatement.setInt(19, this.getCode());
                preparedStatement.setString(20, this.getMsg());
                preparedStatement.setInt(21, this.getlFed());
                preparedStatement.setInt(22, this.getlReg());
                preparedStatement.setInt(23, this.getlDor());
                preparedStatement.executeUpdate();
                ResultSet resultSet = preparedStatement.getGeneratedKeys();
                if(resultSet.next()){
                    this.setId(resultSet.getInt(1));
                }
            } catch (SQLException e) {
                e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
            }
        }
    }