@Override
 public void setDegreeModule(DegreeModule degreeModule) {
   if (degreeModule != null && !(degreeModule instanceof BranchCourseGroup)) {
     throw new DomainException(
         "error.curriculumGroup.BranchParentDegreeModuleCanOnlyBeBranchCourseGroup");
   }
   super.setDegreeModule(degreeModule);
 }
  @Override
  protected void checkInitConstraints(CurriculumGroup parent, CourseGroup courseGroup) {
    super.checkInitConstraints(parent, courseGroup);

    final BranchCourseGroup branchCourseGroup = (BranchCourseGroup) courseGroup;

    final CycleCurriculumGroup cycle = parent.getParentCycleCurriculumGroup();
    if (cycle != null && cycle.hasBranchCurriculumGroup(branchCourseGroup.getBranchType())) {
      throw new DomainException(
          "error.BranchCurriculumGroup.parent.cycle.cannot.have.another.branch.with.same.type");
    }
  }