@Override
  public OperationResult run(Connection conn) throws SQLException {
    // First, find the user
    User user = Queries.getUser(conn, spec.getUsername(), this);
    if (user == null) {
      return new OperationResult(false, "Unknown user " + spec.getUsername());
    }

    // Create the CourseRegistration
    CourseRegistration reg = new CourseRegistration();
    reg.setUserId(user.getId());
    reg.setCourseId(spec.getCourseId());
    reg.setRegistrationType(spec.getRegistrationType());
    reg.setSection(spec.getSection());

    // Insert the CourseRegistration
    DBUtil.storeModelObject(conn, reg);

    Course course = null;
    try {
      course = DBUtil.loadModelObjectForId(conn, Course.SCHEMA, spec.getCourseId());
    } catch (NoSuchUniqueIdException e) {
      logger.error("Could not find course for id={}", spec.getCourseId());
    }

    return new OperationResult(
        true,
        "Added user "
            + spec.getUsername()
            + " to course"
            + (course != null ? " " + course.getNameAndTitle() : ""));
  }