public void ExecuteCallout(String definitionParameters, CalloutData data)
        {
            var requestUrl = ExtractUrlFromDefinition(definitionParameters);
            var headers = ExtractAuthorizationHeadersFromDefinition(definitionParameters);

            if (null == data)
            {
                Debug.WriteLine("CalloutData is null");
                throw new ArgumentNullException("data", "CalloutData must not be null");
            }

            Debug.WriteLine("Executing callout to '{0}'", requestUrl.ToString());

            try
            {
                _restCallExecutor.Invoke(HttpMethod.Post, requestUrl.ToString(), headers, JsonConvert.SerializeObject(data));
            }
            catch (HttpRequestException e)
            {
                Debug.WriteLine("Error occurred while executing callout: {0}", e.Message);
                throw;
            }
        }
 private String CreateJob(Uri entityUri, String tenantId, CalloutData calloutData)
 {
     var token = calloutData.CallbackUrl.Split('(', ')')[1];
     SetCoreServiceCredentialsBasedOnConfigValues();
     _coreService.AddToJobs(new Job
     {
         State = JobStateEnum.Running.ToString(),
         Type = CALLOUT_JOB_TYPE,
         Parameters = JsonConvert.SerializeObject(calloutData),
         ReferencedItemId = entityUri.ToString(),
         TenantId = tenantId,
         Token = token
     });
     _coreService.SaveChanges();
     return token;
 }