I have the following structure:

```
[Employee]
ID
Manager1ID
Manager2ID

```

**Scenario:**

I want to make a validation to ensure that the chosen Manager1 or Manager2 does not cause a round. In other words, I want to know whether this case exists:

> 
> The manager of A is B & the manager of B is C and the manger of C is also A // not valid
> 
> 
> A => B => C => **A**
> 
> 
> 

To tell the user that **A** is not a valid manager for **C** because C is already a manager of A
.

---

**The problem:**

I though of checking in a while loop the managers as parents in a tree, and when I found the chosen manager in the list I know that it is not valid. (Two loops for tow lists for Manager1 and Manager2)

The problem is that every employee might have two managers and a round maybe exists in a case like this:

> 
> A => B (Manager1) => C (Manager2) => A
> 
> 
> 

Which is not able to check in my suggested solution.

Any idea!