public void create(Connection connection, Membershiptype membershiptype) {
        PreparedStatement preparedstatement = null;
        try {
            preparedstatement = connection.prepareStatement("insert into civicrm_membership_type values (null, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");

            preparedstatement.setInt(1, membershiptype.getDomain_id());
            preparedstatement.setString(2, membershiptype.getName());
            preparedstatement.setString(3, membershiptype.getDescription());
            preparedstatement.setInt(4, membershiptype.getMember_of_contact_id());
            preparedstatement.setInt(5, membershiptype.getContribution_type_id());
            preparedstatement.setFloat(6, membershiptype.getMinimum_fee());
            String duration_unit_value;
            switch (membershiptype.getDuration_unit()) {
                case DAY:
                    duration_unit_value = "day";
                    break;
                case MONTH:
                    duration_unit_value = "month";
                    break;
                case YEAR:
                    duration_unit_value = "year";
                    break;
                default:
                    duration_unit_value = "";
            }
            preparedstatement.setString(7, duration_unit_value);
            preparedstatement.setInt(8, membershiptype.getDuration_interval());
            String period_type_value;
            switch (membershiptype.getPeriod_type()) {
                case ROLLING:
                    period_type_value = "rolling";
                    preparedstatement.setNull(10, java.sql.Types.INTEGER);
                    preparedstatement.setNull(11, java.sql.Types.INTEGER);
                    break;
                case FIXED:
                    period_type_value = "fixed";
                    preparedstatement.setInt(10, membershiptype.getFixed_period_start_day());
                    preparedstatement.setInt(11, membershiptype.getFixed_period_rollover_day());
                    break;
                default:
                    period_type_value = "";
            }
            preparedstatement.setString(9, period_type_value);
            preparedstatement.setString(12, membershiptype.getRelationship_type_id());
            preparedstatement.setString(13, membershiptype.getRelationship_direction());
            preparedstatement.setString(14, membershiptype.getVisibility());
            preparedstatement.setInt(15, membershiptype.getWeight());
            //preparedstatement.setInt(16, membershiptype.getRenewal_msg_id());
            preparedstatement.setNull(16, java.sql.Types.INTEGER);
            preparedstatement.setInt(17, membershiptype.getRenewal_reminder_day());
            preparedstatement.setString(18, membershiptype.getReceipt_text_signup());
            preparedstatement.setString(19, membershiptype.getReceipt_text_renewal());
            //preparedstatement.setInt(20, membershiptype.getAutorenewal_msg_id());
            preparedstatement.setNull(20, java.sql.Types.INTEGER);
            preparedstatement.setBoolean(21, membershiptype.isAuto_renew());
            preparedstatement.setBoolean(22, membershiptype.isIs_active());

            preparedstatement.executeUpdate();
        } catch (SQLException ex) {
            Logger.getLogger(MembershiptypeController.class.getName()).log(Level.SEVERE, null, ex);
        } finally {
            try {
                if (!preparedstatement.isClosed()) {
                    preparedstatement.close();
                }
            } catch (SQLException ex) {
                Logger.getLogger(AddressController.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }