Wouldn't the following be cleaner:

```ruby
def add_resource_descriptor_to_registry(hash_descriptor, registry)
  Crichton::Descriptor::Resource.new(hash_descriptor).tap do |resource_descriptor|
    add_resource_descriptor_to_raw_toplevel_registry(resource_descriptor)

    resource_descriptor.descriptors.each do |descriptor|
      if registry[descriptor.id]
        raise ArgumentError, "Resource descriptor for #{descriptor.id} is already registered."
      end
      registry[descriptor.id] = descriptor
    end
  end
end
```