public Long deleteMeetingMember(Long meetingMemberId) {
    log.debug("MeetingMemnerDAoImpl.deleteMeetingMember : " + meetingMemberId);

    try {

      MeetingMember gm = this.getMeetingMemberById(meetingMemberId);

      log.debug("ac: " + gm);

      if (gm == null) {
        log.debug("Already deleted / Could not find: " + meetingMemberId);
        return null;
      }
      gm.setUpdatetime(new Date());
      gm.setDeleted(true);

      if (gm.getMeetingMemberId() == null) {
        em.persist(gm);
      } else {
        if (!em.contains(gm)) {
          em.merge(gm);
        }
      }
      return meetingMemberId;
    } catch (Exception ex2) {
      log.error("[deleteMeetingMember]: ", ex2);
    }
    return null;
  }
  public Long updateMeetingMember(
      Long meetingMemberId,
      String firstname,
      String lastname,
      String memberStatus,
      String appointmentStatus,
      Long appointmentId,
      Long userid,
      String email,
      String phone) {
    try {

      MeetingMember gm = this.getMeetingMemberById(meetingMemberId);
      /*
       * if (gm == null) { log.debug("ALERT Object with ID: "+
       * MeetingMemberId +" does not exist yet"); return null; }
       */

      gm.setFirstname(firstname);
      gm.setLastname(lastname);

      // gm.setLanguageId(Languagemanagement.getInstance().getFieldLanguageById(languageId));
      gm.setMemberStatus(memberStatus);
      gm.setAppointmentStatus(appointmentStatus);
      gm.setAppointment(appointmentDao.getAppointmentById(appointmentId));
      gm.setDeleted(false);
      gm.setUpdatetime(new Date());
      gm.setUserid(usersDao.get(userid));
      gm.setEmail(email);
      gm.setPhone(phone);

      if (gm.getMeetingMemberId() == null) {
        em.persist(gm);
      } else {
        if (!em.contains(gm)) {
          gm = em.merge(gm);
        }
      }
      meetingMemberId = gm.getMeetingMemberId();
      return meetingMemberId;
    } catch (Exception ex2) {
      log.error("[updateMeetingMember]: ", ex2);
    }
    return null;
  }
  public Long addMeetingMember(
      String firstname,
      String lastname,
      String memberStatus,
      String appointmentStatus,
      Long appointmentId,
      Long userid,
      String email,
      String phone,
      Boolean moderator,
      OmTimeZone omTimeZone,
      Boolean isConnectedEvent) {
    try {

      MeetingMember gm = new MeetingMember();

      gm.setFirstname(firstname);
      gm.setLastname(lastname);
      gm.setMemberStatus(memberStatus);
      gm.setAppointmentStatus(appointmentStatus);
      gm.setAppointment(appointmentDao.getAppointmentById(appointmentId));
      gm.setUserid(userid == null ? null : usersDao.get(userid));
      gm.setEmail(email);
      gm.setPhone(phone);

      gm.setStarttime(new Date());
      gm.setDeleted(false);
      gm.setInvitor(moderator);
      gm.setIsConnectedEvent(isConnectedEvent);

      gm.setOmTimeZone(omTimeZone);

      gm = em.merge(gm);
      Long group_member_id = gm.getMeetingMemberId();

      return group_member_id;
    } catch (Exception ex2) {
      log.error("[addMeetingMember]: ", ex2);
    }
    return null;
  }