How to implement dependency dropdown in metadata card for a lookup with multiple dependency?

A multi-tenant base application is integrated to M-Files for syncing documents. In a document metadata, there are lookup for tenant, entity and document storage. Every storage is associated with exactly one entity and entities are fixed for all tenants. But storage are not common. One storage can't be found in another tenant. 

Now I want to implement dependency dropdown for storage so that when a tenant lookup and a entity lookup is selected, only the storage objects that are within that tenant and entity, will be shown. 

Storage object has its tenant property and entity property. So now how can I compare tenant property in document object with tenant in storage object and filter the list in the document metadata section in M-Files client?