public void save() { TutorshipIntention intention = TutorshipIntention.readByDcpAndTeacherAndInterval(dcp, teacher, academicInterval); ExecutionYear executionYear = (ExecutionYear) ExecutionYear.getExecutionInterval(academicInterval); if (intention == null && intending) { new TutorshipIntention(dcp, teacher, academicInterval); ProgramTutoredParticipationLog.createLog( dcp.getDegree(), executionYear, Bundle.MESSAGING, "log.degree.programtutoredparticipation.addteacher", teacher.getPerson().getPresentationName(), dcp.getDegree().getPresentationName()); } else if (intention != null && !intending) { ProgramTutoredParticipationLog.createLog( dcp.getDegree(), executionYear, Bundle.MESSAGING, "log.degree.programtutoredparticipation.removeteacher", teacher.getPerson().getPresentationName(), dcp.getDegree().getPresentationName()); intention.delete(); } }