code: public void addCohort(Cohort cohort, String studyId) {
          // Sanity check
          if (cohort == null || StringUtils.isEmpty(cohort.getId())) {
              logger.error("Cohort (or its ID) is null or empty.");
              return;
          }
  
          VariantStudyMetadata variantStudyMetadata = getVariantStudyMetadata(studyId);
          if (variantStudyMetadata == null) {
              logger.error("Study not found. Check your study ID: '{}'", studyId);
              return;
          }
          if (variantStudyMetadata.getCohorts() == null) {
              variantStudyMetadata.setCohorts(new ArrayList<>());
          }
          for (Cohort coho: variantStudyMetadata.getCohorts()) {
              if (coho.getId() != null && coho.getId().equals(cohort.getId())) {
                  logger.error("Cohort with id '{}' already exists in study '{}'", cohort.getId(),
                          studyId);
                  return;
              }
          }
          variantStudyMetadata.getCohorts().add(cohort);
      }
docs: Add a cohort to a given variant study metadata (from study ID).
  
  @param cohort    Cohort to add
  @param studyId   Study ID