public async Task <IHalResource> Create <TEntity>(Uri url, TEntity resource)
        {
            using var client = new HttpClient();

            var newItemJsonString = JsonSerializer.Serialize(resource);

            var content = new StringContent(newItemJsonString, Encoding.UTF8, "application/json");

            using HttpResponseMessage response = await client.PostAsync(url, content);

            var responseBody = await response.Content.ReadAsStringAsync();

            if (!response.IsSuccessStatusCode)
            {
                var problemDetails = JsonSerializer.Deserialize <Problem>(responseBody, new JsonSerializerOptions
                {
                    PropertyNameCaseInsensitive = true,
                });

                throw new ProblemException(problemDetails);
            }

            var halResource = new HalResource(responseLoader, entityMapperFactory);

            halResource.Load(responseBody);

            return(halResource);
        }
        public async Task <IHalResource> GetResource(Uri resourceUri)
        {
            string jsonString;

            using (var client = new HttpClient())
            {
                client.BaseAddress = resourceUri;

                var result = await client.GetAsync(resourceUri.ToString());

                jsonString = await result.Content.ReadAsStringAsync();
            }

            var halResource = new HalResource(responseLoader, entityMapperFactory);

            halResource.Load(jsonString);

            return(halResource);
        }