Hello, I need some help validating the button to prevent it from creating the same links. I have the following screen:

in it I can link / unlink machines / equipment. formula in the link button:
ForAll(
ForAll(
Filter(
'GalleryTodasMaquinas/Equips'.AllItems;
Checkbox2.Value=true
);
{
'ID- Máquina':ThisRecord
}
);
Patch(
'VÃnculos Funcionário/Máquina';
Defaults('VÃnculos Funcionário/Máquina');
{
'ID- Funcionario': GalleryTodosFuncionariosAtivos.Selected;
'ID- Máquina': ThisRecord.'ID- Máquina'
}
)
)
However, I can create the same link infinitely many times. I would like to know if it is possible to create a validation between the two galleries so that I cannot create the same link more than once.
I tried using the following formula but without success the button always becomes inactive for some reason:
If(
!IsBlank('GalleryTodasMaquinas/Equips'.Selected); // Verifica se há itens selecionados na primeira galeria
If(
!IsEmpty(
Filter(
GalleryTodosVinculadosMaq.AllItems; // Todas as máquinas vinculadas na segunda galeria
'ID- Máquina' in ForAll(
'GalleryTodasMaquinas/Equips'.AllItems; // Todas as máquinas selecionadas na primeira galeria
'ID- Máquina' // Retorna uma lista de IDs das máquinas selecionadas na primeira galeria
)
)
); // Verifica se há alguma máquina na segunda galeria que está na lista de máquinas selecionadas na primeira galeria
DisplayMode.Disabled; // Se houver uma correspondência; desabilita o botão
DisplayMode.Edit // Se não houver correspondência; permite a edição do botão
);
DisplayMode.Disabled // Se não houver itens selecionados na primeira galeria; desabilita o botão
)