/// <summary>
        /// Constructs the resource
        /// </summary>
        private JToken GetResource(string resourceId, string apiVersion)
        {
            var resource = this.GetExistingResource(resourceId, apiVersion).Result.ToResource();
            
            var policyDefinitionObject = new PolicyDefinition
            {
                Name = this.Name ?? ResourceIdUtility.GetResourceName(this.Id),
                Properties = new PolicyDefinitionProperties
                {
                    Description = this.Description ?? (resource.Properties["description"] != null 
                        ? resource.Properties["description"].ToString()
                        : null),
                    DisplayName = this.DisplayName ?? (resource.Properties["displayName"] != null
                        ? resource.Properties["displayName"].ToString()
                        : null)
                }
            };
            if(!string.IsNullOrEmpty(this.Policy))
            {
                policyDefinitionObject.Properties.PolicyRule = JObject.Parse(GetPolicyRuleObject().ToString());
            }
            else
            {
                policyDefinitionObject.Properties.PolicyRule = JObject.Parse(resource.Properties["policyRule"].ToString());
            }

            return policyDefinitionObject.ToJToken();
        }
        /// <summary>
        /// Constructs the resource
        /// </summary>
        private JToken GetResource()
        {
            var policyDefinitionObject = new PolicyDefinition
            {
                Name = this.Name,
                Properties = new PolicyDefinitionProperties
                {
                    Description = this.Description ?? null,
                    DisplayName = this.DisplayName ?? null,
                    PolicyRule = JObject.Parse(GetPolicyRuleObject().ToString())
                }
            };

            return policyDefinitionObject.ToJToken();
        }