internal static T ExecuteOperation(string url, HttpMethod method, string username, string password, string body = "", string jsonRoot = "")
        {
            ActivitiRESTClient <T> client   = InitClient(FormatUrl(url), method, body);
            Response <T>           response = null;

            switch (method)
            {
            case HttpMethod.POST:
                response = client.Post(username, password);
                break;

            case HttpMethod.PUT:
                response = client.Post(username, password);
                break;

            case HttpMethod.GET:
                response = client.Get(username, password);
                break;

            case HttpMethod.DELETE:
                response = client.Delete(username, password);
                break;

            default:
                return(null);
            }

            return(response.ParseResponse(jsonRoot));
        }
        internal static byte[] GetBytes(string url, string username, string password)
        {
            ActivitiRESTClient <T> client   = InitClient(FormatUrl(url), HttpMethod.GET, string.Empty);
            Response <T>           response = null;

            response = client.Get(username, password, true);

            return(response.ByteData);
        }
        internal static Dictionary <string, string> GetProperties(string url, string username, string password)
        {
            ActivitiRESTClient <T>      client     = InitClient(FormatUrl(url), HttpMethod.GET, string.Empty);
            Response <T>                response   = null;
            Dictionary <string, string> properties = new Dictionary <string, string>();

            response = client.Get(username, password, true);
            if (response.Exception != null)
            {
                JObject json = JObject.Parse(response.Body);

                foreach (JToken jsonToken in json.Children())
                {
                    var next = jsonToken.Next;
                }

                return(properties);
            }
            else
            {
                throw response.Exception;
            }
        }