private void CreateUser(string userId, string userName, string userExternalId, string userProfileUrl, string userEmail, Dictionary <string, object> userCustom, Dictionary <string, object> externalQueryParam, PNCallback <PNCreateUserResult> callback) { if (string.IsNullOrEmpty(userId) || string.IsNullOrEmpty(userId.Trim()) || userName == null) { throw new ArgumentException("Missing Id or Name"); } if (string.IsNullOrEmpty(config.SubscribeKey) || string.IsNullOrEmpty(config.SubscribeKey.Trim()) || config.SubscribeKey.Length <= 0) { throw new MissingMemberException("Invalid subscribe key"); } if (callback == null) { throw new ArgumentException("Missing userCallback"); } IUrlRequestBuilder urlBuilder = new UrlRequestBuilder(config, jsonLibrary, unit, pubnubLog, pubnubTelemetryMgr); urlBuilder.PubnubInstanceId = (PubnubInstance != null) ? PubnubInstance.InstanceId : ""; Uri request = urlBuilder.BuildCreateUserRequest(userCustom, externalQueryParam); RequestState <PNCreateUserResult> requestState = new RequestState <PNCreateUserResult>(); requestState.ResponseType = PNOperationType.PNCreateUserOperation; requestState.PubnubCallback = callback; requestState.Reconnect = false; requestState.EndPointOperation = this; string json = ""; requestState.UsePostMethod = true; Dictionary <string, object> messageEnvelope = new Dictionary <string, object>(); messageEnvelope.Add("id", userId); messageEnvelope.Add("name", userName); if (userExternalId != null) { messageEnvelope.Add("externalId", userExternalId); } if (userProfileUrl != null) { messageEnvelope.Add("profileUrl", userProfileUrl); } if (userEmail != null) { messageEnvelope.Add("email", userEmail); } if (userCustom != null) { messageEnvelope.Add("custom", userCustom); } string postMessage = jsonLibrary.SerializeToJsonString(messageEnvelope); json = UrlProcessRequest <PNCreateUserResult>(request, requestState, false, postMessage); if (!string.IsNullOrEmpty(json)) { List <object> result = ProcessJsonResponse <PNCreateUserResult>(requestState, json); ProcessResponseCallbacks(result, requestState); } }