public Examination Read(string filePath) { XSSFWorkbook xssfBook; using (FileStream file = new FileStream(filePath, FileMode.Open, FileAccess.Read)) { xssfBook = new XSSFWorkbook(file); } ISheet sheet = xssfBook.GetSheet(xssfBook.GetSheetName(0)); Patient client = ReadClient(sheet); ExaminationType type = sheet.GetExaminationType(); if (type == ExaminationType.UNKNOWN) { throw new UnknownExaminationTypeException(Path.GetFileName(filePath)); } else if (type == ExaminationType.CANDIDIASIS) { return(CreateCandidiasisExamination(sheet, type, client)); } else { return(CreateExamination(sheet, type, client)); } }