private Task <bool> GetPlayerNameFromProfile(PlayerListEntry player)
    {
        TaskCompletionSource <bool> t = new TaskCompletionSource <bool>();

        PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest()
        {
            FunctionName            = "getEntityDisplayName",
            FunctionParameter       = player.EntityId,
            GeneratePlayStreamEvent = true
        },
                                            (response) => {
            var result = response.FunctionResult;
            if (result != null)
            {
                PlayFab.Json.JsonObject obj = (PlayFab.Json.JsonObject)result;
                object name;
                obj.TryGetValue("Result", out name);
                player.DisplayName = name.ToString();
                player.IsSelected  = (player.DisplayName == currentPlayer);

                //player.DisplayName = result.GetType().GetProperty("DisplayName").GetValue(result, null).ToString();
            }
            t.SetResult(true);
        },
                                            PlayFabErrorHandler
                                            );
        return(t.Task);
    }
    // OnCloudHelloWorld defined in the next code block
    private void OnCloudUpdateStats(ExecuteCloudScriptResult result)
    {
        // Cloud Script returns arbitrary results, so you have to evaluate them one step and one parameter at a time
        // Debug.Log(JsonWrapper.SerializeObject(result.FunctionResult));
        JsonObject jsonResult = (JsonObject)result.FunctionResult;
        object     messageValue;

        jsonResult.TryGetValue("messageValue", out messageValue); // note how "messageValue" directly corresponds to the JSON values set in Cloud Script
        Debug.Log((string)messageValue);
    }