You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: fetch_remote_distributions_job.rb
    path of file: ./repos/open-build-service/src/api/app/jobs
    
    the code of the file until where you have to start completion: class FetchRemoteDistributionsJob < ApplicationJob
  def perform
    Project.remote.each do |project|
      distributions_xml = Project::RemoteURL.load(project, '/distributions.xml')

      # don't let broken remote instances break us
      if Xmlhash.parse(distributions_xml.to_s).blank?
        Distribution.remote.for_
    
  def bulk_replace(project:, distributions_xmlhash: Xmlhash.new)
    errors = []
    distributions = []

    distributions_xmlhash.elements('distribution') do |distribution_xmlhash|
      distribution = Distribution.new_from_xmlhash(distribution_xmlhash)
      distribution.project = "#{project}:#{distribution.project}"
      distribution.remote = true
      distributions << distribution
      errors << distributions.errors unless distribution.valid?
    end

    raise "#{errors.map(&:full_messages)}" if errors.any? || distributions.empty?

    Distribution.remote.for_project(project).destroy_all
    distributions.map(&:save!)
  end