refactor hash of hashes to AssociationDefinition class