def payload
      payload = @random_generator.payload
      # ensure the base payload is valid
      errors = validation_errors_for(payload)
      raise InvalidContentGenerated, error_message(payload, errors) if errors.any?

      if block_given?
        payload = yield(payload)
        # check the payload again after customisation
        errors = validation_errors_for(payload)
        raise InvalidContentGenerated, error_message(payload, errors, true) if errors.any?
      end

      payload
    end
def payload
      payload = @random_generator.payload
      # ensure the base payload is valid
      errors = validation_errors_for(payload)
      raise InvalidContentGenerated, error_message(payload, errors) if errors.any?

      if block_given?
        payload = yield(payload)
        # check the payload again after customisation
        errors = validation_errors_for(payload)
        raise InvalidContentGenerated, error_message(payload, errors, true) if errors.any?
      end

      payload
    end
Return a content item merged with a hash and with the excluded fields removed.
 If the resulting content item isn't valid against the schema an error will be raised.

 Example without block:

      generator.payload
      # => {"base_path"=>"/e42dd28e", "title"=>"dolor est...", "publishing_app"=>"elit"...}

 Example with block:

      generator.payload do |payload|
        payload.merge('base_path' => "Test base path")
      end
      # => {"base_path"=>"Test base path", "title"=>"dolor est...", "publishing_app"=>"elit"...}

 @param [Block] the base payload is passed inton the block, with the block result then becoming
   the new payload. The new payload is then validated. (optional)
 @return [Hash] A content item
 @raise [GovukSchemas::InvalidContentGenerated]