code: def __load_enrollments(self, enrollments, uuid, verbose):
          
  
          self.log("-- loading enrollments", verbose)
  
          organizations = []
  
          for enrollment in enrollments:
              organization = enrollment.organization.name
  
              try:
                  api.add_organization(self.db, organization)
              except AlreadyExistsError as e:
                  msg = "%s. Organization not updated." % str(e)
                  self.warning(msg, verbose)
  
              if organization not in organizations:
                  organizations.append(organization)
  
              from_date = max(MIN_PERIOD_DATE, enrollment.start)
              to_date = min(MAX_PERIOD_DATE, enrollment.end)
  
              if from_date != enrollment.start or to_date != enrollment.end:
                  msg = "Dates out of bound. Set to %s and %s." % (str(from_date), str(to_date))
                  self.warning(msg, verbose)
  
              try:
                  api.add_enrollment(self.db, uuid, enrollment.organization.name,
                                     from_date, to_date)
              except AlreadyExistsError as e:
                  msg = "%s. Enrollment not updated." % str(e)
                  self.warning(msg, verbose)
              except (ValueError, NotFoundError) as e:
                  raise LoadError(cause=str(e))
  
          for organization in organizations:
              api.merge_enrollments(self.db, uuid, organization)
  
          self.log("-- enrollments loaded", verbose)
docs: Store enrollments