// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILogger <IFhirService> logger)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseExceptionHandler(a => a.Run(async context =>
            {
                var feature = context.Features.Get <IExceptionHandlerPathFeature>();
                if (feature?.Error != null)
                {
                    var exception = feature.Error;

                    var operationOutcome         = ErrorHandlingMiddleware.GetOperationOutCome(exception, true);
                    var fhirJsonConverter        = new FhirJsonSerializer();
                    var result                   = fhirJsonConverter.SerializeToString(operationOutcome);
                    context.Response.ContentType = "application/json";
                    await context.Response.WriteAsync(result);
                }
            }));

            app.ConfigureExceptionHandler(logger);
            app.UseMvc();
        }