module Avo::Concerns::FindAssociationField

def find_association_field(resource:, association:)

based on the provided association name.
and the method will return the first matching association field
However, there are cases where the type is unknown
Ideally, the exact type of the association should be known in advance.
This method is used to find an association field for a given resource.
def find_association_field(resource:, association:)
  resource.get_field_definitions.find do |field|
    (field.id == association.to_sym) && field.type.in?(ASSOCIATIONS)
  end
end