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: clean_old_releases_job.rb
    path of file: ./repos/zealot/app/jobs
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

class CleanOldReleasesJob < ApplicationJob
  queue_as :schedule

  def perform
    channels = Channel.all
    channels.each do |channel|
    
  def clean_previouse_build_version(channel, release_version)
    releases = channel.releases.where(release_version: release_version)
    return if releases.size <= 1

    versions = releases.map(&:version)
    latest_version = versions.max { |a,b| compare_version(a, b) }
    logger.info("Delete channel [#{channel.id} - #{channel.app_name}] has versions: #{versions}
                and latest verison is #{latest_version}")

    remove_releases(channel, releases, latest_version)
  end