Refactor and fix TenantManage for repeated queries