public async Task <ActionResult <LineItem> > AddLineItemAsync([Required] string contextId, [Required][FromBody] LineItem lineItem)
        {
            try
            {
                _logger.LogDebug($"Entering {nameof(AddLineItemAsync)}.");

                try
                {
                    var request = new AddLineItemRequest(contextId, lineItem);
                    return(await OnAddLineItemAsync(request).ConfigureAwait(false));
                }
                catch (Exception ex)
                {
                    _logger.LogError(ex, $"An unexpected error occurred in {nameof(OnAddLineItemAsync)}.");
                    return(StatusCode(StatusCodes.Status500InternalServerError, new ProblemDetails
                    {
                        Title = "An unexpected error occurred",
                        Status = StatusCodes.Status500InternalServerError,
                        Detail = _env.IsDevelopment()
                            ? ex.Message + ex.StackTrace
                            : ex.Message
                    }));
                }
            }
            finally
            {
                _logger.LogDebug($"Exiting {nameof(AddLineItemAsync)}.");
            }
        }
 /// <summary>
 /// Add a line item to the context.
 /// </summary>
 /// <param name="request">The request parameters.</param>
 /// <returns>The line item.</returns>
 protected abstract Task <ActionResult <LineItem> > OnAddLineItemAsync(AddLineItemRequest request);