def save(connection)
      new_site = @id == -1

      if new_site
        resp = AJAX.post(connection, '/api/2.1/site_configurations/', to_json, AJAX::CONTENT_TYPE::JSON)
        @id = resp.to_i
      else
        AJAX.put(connection, "/api/2.1/site_configurations/#{@id}", to_json, AJAX::CONTENT_TYPE::JSON)
      end

      # Retrieve the scan engine and shared credentials and add them to the site configuration
      site_config         = Site.load(connection, @id)
      @engine_id          = site_config.engine_id
      @shared_credentials = site_config.shared_credentials
      @alerts             = site_config.alerts

      @id
    end
def save(connection)
      new_site = @id == -1

      if new_site
        resp = AJAX.post(connection, '/api/2.1/site_configurations/', to_json, AJAX::CONTENT_TYPE::JSON)
        @id = resp.to_i
      else
        AJAX.put(connection, "/api/2.1/site_configurations/#{@id}", to_json, AJAX::CONTENT_TYPE::JSON)
      end

      # Retrieve the scan engine and shared credentials and add them to the site configuration
      site_config         = Site.load(connection, @id)
      @engine_id          = site_config.engine_id
      @shared_credentials = site_config.shared_credentials
      @alerts             = site_config.alerts

      @id
    end
Saves this site to a Nexpose console.
 If the site is dynamic, connection and asset filter changes must be
 saved through the DiscoveryConnection#update_site call.

 @param [Connection] connection Connection to console where this site will be saved.
 @return [Fixnum] Site ID assigned to this configuration, if successful.