/// <inheritdoc />
        public override BigQueryDataset CreateDataset(DatasetReference datasetReference, CreateDatasetOptions options = null)
        {
            GaxPreconditions.CheckNotNull(datasetReference, nameof(datasetReference));
            var dataset = new Dataset {
                DatasetReference = datasetReference
            };
            var request = Service.Datasets.Insert(dataset, datasetReference.ProjectId);

            options?.ModifyRequest(dataset, request);
            return(new BigQueryDataset(this, request.Execute()));
        }
        private InsertRequest CreateInsertDatasetRequest(DatasetReference datasetReference, CreateDatasetOptions options)
        {
            GaxPreconditions.CheckNotNull(datasetReference, nameof(datasetReference));
            var dataset = new Dataset {
                DatasetReference = datasetReference, Location = DefaultLocation
            };
            var request = Service.Datasets.Insert(dataset, datasetReference.ProjectId);

            options?.ModifyRequest(dataset, request);
            return(request);
        }
        /// <inheritdoc />
        public override async Task <BigQueryDataset> CreateDatasetAsync(DatasetReference datasetReference, CreateDatasetOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            GaxPreconditions.CheckNotNull(datasetReference, nameof(datasetReference));
            var dataset = new Dataset {
                DatasetReference = datasetReference
            };
            var request = Service.Datasets.Insert(dataset, datasetReference.ProjectId);

            options?.ModifyRequest(dataset, request);
            return(new BigQueryDataset(this, await request.ExecuteAsync(cancellationToken).ConfigureAwait(false)));
        }
        private InsertRequest CreateInsertDatasetRequest(DatasetReference datasetReference, Dataset resource, CreateDatasetOptions options)
        {
            GaxPreconditions.CheckNotNull(datasetReference, nameof(datasetReference));
            GaxPreconditions.CheckArgument(
                resource?.DatasetReference == null || datasetReference.ReferencesSameAs(resource.DatasetReference),
                nameof(resource.DatasetReference),
                $"If {nameof(resource.DatasetReference)} is specified, it must be the same as {nameof(datasetReference)}");

            resource ??= new Dataset();
            resource.DatasetReference ??= datasetReference;
            resource.Location ??= DefaultLocation;

            var request = Service.Datasets.Insert(resource, datasetReference.ProjectId);

            options?.ModifyRequest(request);
            return(request);
        }