/// <summary>
 /// Create or update a WATMv2 profile within a resource group.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.TrafficManager.IProfileOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. The name of the resource group.
 /// </param>
 /// <param name='profileName'>
 /// Required. The name of the zone without a terminating dot.
 /// </param>
 /// <param name='parameters'>
 /// Required. Parameters supplied to the CreateOrUpdate operation.
 /// </param>
 /// <returns>
 /// The response to a Profile CreateOrUpdate operation.
 /// </returns>
 public static ProfileCreateOrUpdateResponse CreateOrUpdate(this IProfileOperations operations, string resourceGroupName, string profileName, ProfileCreateOrUpdateParameters parameters)
 {
     return Task.Factory.StartNew((object s) => 
     {
         return ((IProfileOperations)s).CreateOrUpdateAsync(resourceGroupName, profileName, parameters);
     }
     , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }
        public TrafficManagerProfile SetTrafficManagerProfile(TrafficManagerProfile profile)
        {
            var parameteres = new ProfileCreateOrUpdateParameters
            {
                Profile = profile.ToSDKProfile()
            };

            ProfileCreateOrUpdateResponse response = this.TrafficManagerManagementClient.Profiles.CreateOrUpdate(
                profile.ResourceGroupName,
                profile.Name, 
                parameteres
                );

            return TrafficManagerClient.GetPowershellTrafficManagerProfile(profile.ResourceGroupName, profile.Name, response.Profile.Properties);
        }
 /// <summary>
 /// Create or update a Traffic Manager profile.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.TrafficManager.IProfileOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. The name of the resource group containing the Traffic
 /// Manager profile.
 /// </param>
 /// <param name='profileName'>
 /// Required. The name of the Traffic Manager profile.
 /// </param>
 /// <param name='parameters'>
 /// Required. The Traffic Manager profile parameters supplied to the
 /// CreateOrUpdate operation.
 /// </param>
 /// <returns>
 /// The response to a Traffic Manager profile 'CreateOrUpdate'
 /// operation.
 /// </returns>
 public static Task<ProfileCreateOrUpdateResponse> CreateOrUpdateAsync(this IProfileOperations operations, string resourceGroupName, string profileName, ProfileCreateOrUpdateParameters parameters)
 {
     return operations.CreateOrUpdateAsync(resourceGroupName, profileName, parameters, CancellationToken.None);
 }