public void create(PypAdmControlProfesionales pypAdmControlProfesionales) {
        if (pypAdmControlProfesionales.getPypAdmAsistConList() == null) {
            pypAdmControlProfesionales.setPypAdmAsistConList(new ArrayList<PypAdmAsistCon>());
        }
        EntityManager em = null;
        try {
            em = getEntityManager();
            em.getTransaction().begin();
            CmProfesionales idProfesional = pypAdmControlProfesionales.getIdProfesional();
            if (idProfesional != null) {
                idProfesional = em.getReference(idProfesional.getClass(), idProfesional.getId());
                pypAdmControlProfesionales.setIdProfesional(idProfesional);
            }
            List<PypAdmAsistCon> attachedPypAdmAsistConList = new ArrayList<PypAdmAsistCon>();
            for (PypAdmAsistCon pypAdmAsistConListPypAdmAsistConToAttach : pypAdmControlProfesionales.getPypAdmAsistConList()) {
                pypAdmAsistConListPypAdmAsistConToAttach = em.getReference(pypAdmAsistConListPypAdmAsistConToAttach.getClass(), pypAdmAsistConListPypAdmAsistConToAttach.getId());
                attachedPypAdmAsistConList.add(pypAdmAsistConListPypAdmAsistConToAttach);
            }
            pypAdmControlProfesionales.setPypAdmAsistConList(attachedPypAdmAsistConList);
            em.persist(pypAdmControlProfesionales);
            if (idProfesional != null) {
                idProfesional.getPypAdmControlProfesionalesList().add(pypAdmControlProfesionales);
                idProfesional = em.merge(idProfesional);
            }
            for (PypAdmAsistCon pypAdmAsistConListPypAdmAsistCon : pypAdmControlProfesionales.getPypAdmAsistConList()) {
                PypAdmControlProfesionales oldIdControlProOfPypAdmAsistConListPypAdmAsistCon = pypAdmAsistConListPypAdmAsistCon.getIdControlPro();
                pypAdmAsistConListPypAdmAsistCon.setIdControlPro(pypAdmControlProfesionales);
                pypAdmAsistConListPypAdmAsistCon = em.merge(pypAdmAsistConListPypAdmAsistCon);
                if (oldIdControlProOfPypAdmAsistConListPypAdmAsistCon != null) {
                    oldIdControlProOfPypAdmAsistConListPypAdmAsistCon.getPypAdmAsistConList().remove(pypAdmAsistConListPypAdmAsistCon);
                    oldIdControlProOfPypAdmAsistConListPypAdmAsistCon = em.merge(oldIdControlProOfPypAdmAsistConListPypAdmAsistCon);
                }
            }
            em.getTransaction().commit();
        } finally {
            if (em != null) {
                em.close();
            }
        }
    }