internal ManagementClient(EndpointUrlBuilder urlBuilder, EndpointUrlBuilderV2 urlBuilderV2, ActionInvoker actionInvoker, IModelProvider modelProvider = null)
 {
     _urlBuilder    = urlBuilder ?? throw new ArgumentNullException(nameof(urlBuilder));
     _urlBuilderV2  = urlBuilderV2 ?? throw new ArgumentNullException(nameof(urlBuilderV2));
     _actionInvoker = actionInvoker ?? throw new ArgumentNullException(nameof(actionInvoker));
     _modelProvider = modelProvider ?? new ModelProvider();
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="ManagementClient"/> class for managing content of the specified project.
        /// </summary>
        /// <param name="ManagementOptions">The settings of the Kentico Kontent project.</param>
        public ManagementClient(ManagementOptions ManagementOptions)
        {
            if (ManagementOptions == null)
            {
                throw new ArgumentNullException(nameof(ManagementOptions));
            }

            if (string.IsNullOrEmpty(ManagementOptions.ProjectId))
            {
                throw new ArgumentException("Kentico Kontent project identifier is not specified.", nameof(ManagementOptions.ProjectId));
            }

            if (!Guid.TryParse(ManagementOptions.ProjectId, out _))
            {
                throw new ArgumentException($"Provided string is not a valid project identifier ({ManagementOptions.ProjectId}). Haven't you accidentally passed the API key instead of the project identifier?", nameof(ManagementOptions.ProjectId));
            }

            if (string.IsNullOrEmpty(ManagementOptions.ApiKey))
            {
                throw new ArgumentException("The API key is not specified.", nameof(ManagementOptions.ApiKey));
            }

            _urlBuilder    = new EndpointUrlBuilder(ManagementOptions);
            _urlBuilderV2  = new EndpointUrlBuilderV2(ManagementOptions);
            _actionInvoker = new ActionInvoker(
                new ManagementHttpClient(new DefaultResiliencePolicyProvider(ManagementOptions.MaxRetryAttempts), ManagementOptions.EnableResilienceLogic),
                new MessageCreator(ManagementOptions.ApiKey));
            _modelProvider = ManagementOptions.ModelProvider ?? new ModelProvider();
        }