public static Task <IMutationResult> UpsertAsync <T>(this ICouchbaseCollection collection, string id, T content,
                                                             Action <UpsertOptions> configureOptions)
        {
            var options = new UpsertOptions();

            configureOptions(options);

            return(collection.UpsertAsync(id, content, options));
        }
        public async Task <IMutationResult> UpsertAsync <T>(string id, T content, UpsertOptions options)
        {
            var transcoder = options.Transcoder ?? _transcoder;

            using (var upsertOp = new Set <T>
            {
                Key = id,
                Content = content,
                Cas = options.Cas,
                Cid = Cid,
                Expires = options.Expiry.ToTtl(),
                DurabilityLevel = options.DurabilityLevel,
                DurabilityTimeout = TimeSpan.FromMilliseconds(1500),
                Transcoder = transcoder
            })
            {
                await _bucket.SendAsync(upsertOp, options.Token, options.Timeout).ConfigureAwait(false);

                return(new MutationResult(upsertOp.Cas, null, upsertOp.MutationToken));
            }
        }