Distributor Registration.
I want to fill list with following information about the distributor
Id
ParentId
Name
For each distributor, it must be determined on whose recommendation the distributor is registered in the system. This can be anyone already registered in the system - in which case they must be selected from a list of already registered distributors, or the referrer information can be blank, which means that the distributor registers in the system without a recommender. Each distributor can bring up to three people on its recommendation, the system should ensure that no more than three people are registered "under" the same distributor. Also, the depth of the hierarchy of the mentioned distributors should be maximum 5 - that is, the distributor can bring a person with a recommendation, who will also bring a person with his recommendation, etc. Maximum 5 levels. Accordingly, in such a group there can be a total of 1 + 3 + 9 + 27 + 81 = 121 people. The system must provide control over the given levels.