public async Task<AdvertisementResource> CreateAdvertisementAsync(Advertisement advertisement)
        {
            if (advertisement == null)
            {
                throw new ArgumentNullException(nameof(advertisement));
            }

            await this.EnsureIndexResourceInitialised();

            return await this._indexResource.CreateAdvertisementAsync(advertisement);
        }
        public async Task<AdvertisementResource> UpdateAdvertisementAsync(Uri uri, Advertisement advertisement)
        {
            if (advertisement == null)
                throw new ArgumentNullException(nameof(advertisement));

            return await this._client.PutResourceAsync<AdvertisementResource, Advertisement>(uri, advertisement);
        }
        public static async Task<AdvertisementResource> CreateAdvertisementExampleAsync(Advertisement advertisementToCreate, IAdPostingApiClient client)
        {
            AdvertisementResource advertisementResource = null;
            try
            {
                await TransientErrorRetryPolicy.ExecuteAsync(async () => advertisementResource = await client.CreateAdvertisementAsync(advertisementToCreate));
                Console.WriteLine($"Created Advertisement:\n{JsonConvert.SerializeObject(advertisementResource, Formatting.Indented)}");
            }
            catch (RequestException ex)
            {
                LogException(ex);
            }

            return advertisementResource;
        }
        public async Task<AdvertisementResource> UpdateAdvertisementAsync(Guid advertisementId, Advertisement advertisement)
        {
            if (advertisement == null)
                throw new ArgumentNullException(nameof(advertisement));

            await this.EnsureIndexResourceInitialised();

            return await this.UpdateAdvertisementAsync(this._indexResource.GenerateAdvertisementUri(advertisementId), advertisement);
        }
 public async Task<AdvertisementResource> CreateAdvertisementAsync(Advertisement advertisement)
 {
     return await this._client.PostResourceAsync<AdvertisementResource, Advertisement>(this.Links.GenerateLink("advertisements"), advertisement);
 }