public Task <T> Execute()
        {
            var task = new TaskCompletionSource <UnityWebRequest>();

            return(MainThreadTask.Run(async() =>
            {
                Debug.Log($"Creating Web Request: {method} {endpoint}");
                var unityWebRequest = new UnityWebRequest(endpoint, method);
                unityWebRequest.SetRequestHeader("Accept", "application/json");
                if (needsAuth)
                {
                    var token = await authorizationProvider();
                    if (string.IsNullOrEmpty(token))
                    {
                        throw new RegenAuthenticationException("token was not retrieved for endpoint " + endpoint);
                    }

                    unityWebRequest.SetRequestHeader("Authorization", $"Bearer {token}");
                }

                if (body != null)
                {
                    unityWebRequest.SetRequestHeader("Content-Type", "application/json; charset=utf-8");
                    unityWebRequest.uploadHandler = new UploadHandlerRaw(Encoding.UTF8.GetBytes(body));
                }

                unityWebRequest.downloadHandler = new DownloadHandlerBuffer();
                Debug.Log($"Sending Web Request: {method} {endpoint}");
                Debug.Log("Authorization: " + unityWebRequest.GetRequestHeader("Authorization"));
                var request = unityWebRequest.SendWebRequest();
                request.completed += operation =>
                {
                    var r = request.webRequest;
                    Debug.Log($"Web Request Complete: {method} {endpoint} {r.responseCode} {r.downloadHandler.text}");
                    if (r.isNetworkError)
                    {
                        task.SetException(new HttpRequestException("Encountered Network Error" + r.error));
                    }
                    else if (r.isHttpError)
                    {
                        task.SetException(new HttpResponseException("Encountered Http Error", r));
                    }
                    else
                    {
                        task.SetResult(r);
                    }
                };
                await task.Task;
                var map = mapping(task.Task.Result);
                Debug.Log($"Mapping Result: {map}");
                return map;
            }));
        }
    public void LogInWithFB()
    {
        Action <string> success = token =>
        {
            ReGenClient.Instance.Authentication.SignInUserWithFacebook(token).Success(user =>
            {
                NotificationManager.Instance.SetLoadingPanel(false);
                SwitchToMainMenu("Login Successful");
            }).Failure(error =>
            {
                NotificationManager.Instance.SetLoadingPanel(false);
                OnAccountActionAttempt?.Invoke(error.Message);
            });
        };

        FacebookManager.Instance.Login(success, error =>
        {
            MainThreadTask.Run(async() =>
            {
                NotificationManager.Instance.SetLoadingPanel(false);
                OnAccountActionAttempt?.Invoke(error);
            });
        });
    }