/// <summary>
        /// Notifies the user that a Unregister Token request has failed.
        /// </summary>
        ///
        /// <param name="serverResponse">A container for information on the response from the server. Only
        /// failed responses can be passed into this method.</param>
        /// <param name="request"> The request that was sent to the server.</param>
        /// <param name="callback">The error callback.</param>
        private void NotifyUnregisterTokenError(ServerResponse serverResponse, UnregisterTokenRequest request, Action <UnregisterTokenRequest, UnregisterTokenError> errorCallback)
        {
            ReleaseAssert.IsTrue(serverResponse.Result != HttpResult.Success || serverResponse.HttpResponseCode != SuccessHttpResponseCode, "Input server request must describe an error.");

            switch (serverResponse.Result)
            {
            case HttpResult.Success:
                m_logging.LogVerboseMessage("Unregister Token request failed with http response code: " + serverResponse.HttpResponseCode);
                break;

            case HttpResult.CouldNotConnect:
                m_logging.LogVerboseMessage("Unregister Token request failed becuase a connection could be established.");
                break;

            default:
                m_logging.LogVerboseMessage("Unregister Token request failed for an unknown reason.");
                throw new ArgumentException("Invalid value for server response result.");
            }

            UnregisterTokenError error = new UnregisterTokenError(serverResponse);

            m_taskScheduler.ScheduleMainThreadTask(() =>
            {
                errorCallback(request, error);
            });
        }
        /// <summary>
        /// Notifies the user that a Unregister Token request was successful.
        /// </summary>
        ///
        /// <param name="serverResponse">A container for information on the response from the server. Only
        /// successful responses can be passed into this method.</param>
        /// <param name="request"> The request that was sent to the server.</param>
        /// <param name="callback">The success callback.</param>
        private void NotifyUnregisterTokenSuccess(ServerResponse serverResponse, UnregisterTokenRequest request, Action <UnregisterTokenRequest> successCallback)
        {
            ReleaseAssert.IsTrue(serverResponse.Result == HttpResult.Success && serverResponse.HttpResponseCode == SuccessHttpResponseCode, "Input server request must describe a success.");

            m_logging.LogVerboseMessage("UnregisterToken request succeeded.");

            m_taskScheduler.ScheduleMainThreadTask(() =>
            {
                successCallback(request);
            });
        }
        /// <summary>
        /// UnRegister a Push Token previously registered. If the Push Token has not been
        /// registered with the currently logged in Player, the request is ignored.
        /// </summary>
        ///
        /// <param name="service">The push notification service the device token belongs to. Must be one of APNS,
        /// GCM or ADM.</param>
        /// <param name="deviceToken">The Push Token. Note: for APNS (iOS) base64 encode the NSData object to form this
        /// string.</param>
        /// <param name="successCallback">The delegate which is called if the request was successful.</param>
        /// <param name="errorCallback">The delegate which is called if the request was unsuccessful. Provides
        /// a container with information on what went wrong.</param>
        public void UnregisterToken(string service, string deviceToken, Action <UnregisterTokenRequest> successCallback, Action <UnregisterTokenRequest, UnregisterTokenError> errorCallback)
        {
            m_logging.LogVerboseMessage("Sending Unregister Token request.");

            var connectAccessToken = m_dataStore.GetString("UserAccessToken");
            var request            = new UnregisterTokenRequest(service, deviceToken, connectAccessToken);

            m_serverRequestSystem.SendImmediateRequest(request, (IImmediateServerRequest sentRequest, ServerResponse serverResponse) =>
            {
                ReleaseAssert.IsTrue(request == sentRequest, "Received request is not the same as the one sent!");

                if (serverResponse.Result == HttpResult.Success && serverResponse.HttpResponseCode == SuccessHttpResponseCode)
                {
                    NotifyUnregisterTokenSuccess(serverResponse, request, successCallback);
                }
                else
                {
                    NotifyUnregisterTokenError(serverResponse, request, errorCallback);
                }
            });
        }