class EntityCrawlerService {

  public OkrCompany getCompanyOfUnit(OkrChildUnit departmentToCheck) {
    OkrUnit parentOkrUnit = departmentToCheck.getParentOkrUnit();
    if (parentOkrUnit instanceof OkrCompany) {
      return (OkrCompany) parentOkrUnit;
    } else {
      return this.getCompanyOfUnit((OkrChildUnit) parentOkrUnit);
    }
  }

}