if (lessonsPeriod == null) { return 0.0; }
    private double calculateLessonsIntervalAndExemptionOverlapPercentage(OccupationPeriod lessonsPeriod,	    TeacherServiceExemption teacherServiceExemption) {	Interval lessonsInterval = new Interval(lessonsPeriod.getStartYearMonthDay().toDateMidnight(),		lessonsPeriod.getEndYearMonthDay().toDateMidnight());	Interval serviceExemptionsInterval = new Interval(teacherServiceExemption.getStartYearMonthDay()		.toDateMidnight(),		(teacherServiceExemption.getEndYearMonthDay() != null) ? teacherServiceExemption			.getEndYearMonthDay().toDateMidnight() : lessonsPeriod.getEndYearMonthDay()			.toDateMidnight());	Interval overlapInterval = lessonsInterval.overlap(serviceExemptionsInterval);	if (overlapInterval != null) {	    int intersectedDays = overlapInterval.toPeriod(PeriodType.days()).getDays();	    return round(Double.valueOf(intersectedDays)		    / Double.valueOf(lessonsInterval.toPeriod(PeriodType.days()).getDays()));	}	return 0.0;    }