async void AddUDF(string body, object idObject)
        {
            string id = idObject as string;
            try
            {
                Documents.UserDefinedFunction udf = new Documents.UserDefinedFunction();
                udf.Body = body;
                udf.Id = id;

                ResourceResponse<Documents.UserDefinedFunction> newudf;
                using (PerfStatus.Start("CreateUDF"))
                {
                    newudf = await this.client.CreateUserDefinedFunctionAsync((this.Parent.Tag as Documents.DocumentCollection).GetLink(this.client), udf, Program.GetMain().GetRequestOptions());
                }

                this.Nodes.Add(new DocumentNode(this.client, newudf.Resource, ResourceType.UserDefinedFunction));

                // set the result window
                string json = newudf.Resource.ToString();

                Program.GetMain().SetResultInBrowser(json, null, false, newudf.ResponseHeaders);

            }
            catch (AggregateException e)
            {
                Program.GetMain().SetResultInBrowser(null, e.InnerException.ToString(), true);
            }
            catch (Exception e)
            {
                Program.GetMain().SetResultInBrowser(null, e.ToString(), true);
            }
        }
        async void AddUDF(string body, string id)
        {
            try
            {
                Documents.UserDefinedFunction udf = new Documents.UserDefinedFunction();
                udf.Body = body;
                udf.Id = id;

                ResourceResponse<Documents.UserDefinedFunction> newudf = await this.client.CreateUserDefinedFunctionAsync ((this.Parent.Tag as Documents.DocumentCollection).SelfLink, udf);

                this.Nodes.Add(new DocumentNode(this.client, newudf.Resource, ResourceType.UserDefinedFunction));

                // set the result window
                string json = newudf.Resource.ToString();

                Program.GetMain().SetResultInBrowser(json, null, false, newudf.ResponseHeaders);

            }
            catch (AggregateException e)
            {
                Program.GetMain().SetResultInBrowser(null, e.InnerException.ToString(), true);
            }
            catch (Exception e)
            {
                Program.GetMain().SetResultInBrowser(null, e.ToString(), true);
            }
        }