def list_app_tenant_users(self, appid, tenantid):
        if not appid:
            print "app id is not present"
            raise Exception("App id not present")
        if not tenantid:
            print "tenant id is not present"
            raise Exception("Tenant id not present")
        users = CGCollection("%s" % self.app_user_profiles_string)
        users.load(self.provider, {"tenantId":tenantid, "clientId":appid})

        if (len(users.collection) == 0):
            return None
        print "test of json: ",users.to_json()
        users = json.loads(users.to_json())
        # users = [t.to_json for t in users.collection]
        print "these are the users fetched", users
        return users
    def list_app_tenants(self, appid):
        if not appid:
            print "app id is not present"
            raise Exception("App id is not present")
        tenants = CGCollection("%s" % self.tenant_profiles_string)
        tenants.load(self.provider,{"clientId":appid})

        if (len(tenants.collection) == 0):
            return None
        tenants = json.loads(tenants.to_json())
        # tenants = [t.to_dict for t in tenants.collection]
        print "these are the tenants fetched",tenants
        return tenants