private bool IsPatientAvailable(int patientCardId, DateTime dateTime) { if (!_activePatientCardRepository.CheckIfPatientCardExists(patientCardId)) { throw new BadRequestException("Patient doesn't exist in database."); } if (_examinationRepository.GetExaminationsByPatientAndDateTime(patientCardId, dateTime).Count > 0) { return(false); } return(true); }