/**
   * This method removes the SSH key with the specified name from this {@link User} object.
   *
   * @param name The name of the SSH key to remove.
   */
  public void removeKey(final String name) {
    Preconditions.checkNotNull(name);

    synchronized (keys) {
      keys.remove(name);
    }

    recorder.append(
        new Modification("Removing key: '%s' for user: '******'", name, getName()) {
          @Override
          public void apply(Config config) throws ModificationException {
            config.getUser(getName()).removeKey(name);
          }
        });
  }
  /**
   * This method allows you to set (and override existing) SSH keys for this particular {@link
   * User}.
   *
   * @param name The name of the key. This may not be NULL.
   * @param content The content of the public key file. This may not be NULL.
   */
  public void setKey(final String name, final String content) {
    Preconditions.checkNotNull(name);
    Preconditions.checkNotNull(content);
    Preconditions.checkArgument(
        name.matches("^[\\w._+-]*$"), "\"" + name + "\" is not a valid key name");
    Preconditions.checkArgument(content.matches("^ssh-rsa\\s.+$"));

    synchronized (keys) {
      keys.put(name, content);
    }

    recorder.append(
        new Modification("Setting key: '%s' for user: '******'", name, getName()) {
          @Override
          public void apply(Config config) throws ModificationException {
            config.getUser(getName()).setKey(name, content);
          }
        });
  }