public IActionResult Patch([FromBody] WeightUpdate value, [FromRoute] string id, [FromQuery(Name = "update_mask")] string updateMask)
        {
            if (!Guid.TryParse(id, out Guid parsedId))
            {
                return(BadRequest("Expected the ID to be a UUID / GUID"));
            }
            // Arrange
            if (string.IsNullOrWhiteSpace(updateMask))
            {
                return(BadRequest("update_mask is required. Fields to be updated must be supplied using their JSON property names. Acceptable field names are: " + this.GetJsonPropertyNameFieldsAsCsv(typeof(WeightUpdate))));
            }

            var updateMaskList = updateMask.Split(',').ToList();

            var weightMeasurement = value.MapTo();

            if (weightMeasurement == null)
            {
                return(BadRequest("Unable to process the request."));
            }
            else if (weightMeasurement.Unit == WeightMeasurement.Units.None && updateMaskList.Contains("unit", StringComparer.InvariantCultureIgnoreCase))
            {
                return(BadRequest("Unable to process the request. Units were not properly defined. Acceptable values are: " + Enum <WeightMeasurement.Units> .GetValuesAsCSV()));
            }
            else
            {
                weightMeasurement.Id = parsedId;
            }

            // Act
            if (!_bizLogic.Exists(weightMeasurement.Id))
            {
                return(NotFound("ID not found."));
            }

            var bizResult = _bizLogic.Update(weightMeasurement, updateMaskList);

            // Response
            if (bizResult.Outcome == MetrikOutcome.Ok)
            {
                WeightUpdated responseResult = WeightUpdated.MapFrom(bizResult.Artifact);
                return(Ok(responseResult));
            }

            return(ParseMetrikResultIntoActionResult(bizResult));
        }
        public IActionResult Put([FromBody] WeightUpdate value, [FromRoute] string id)
        {
            if (!Guid.TryParse(id, out Guid parsedId))
            {
                return(BadRequest("Expected the ID to be a UUID / GUID"));
            }
            // Arrange
            var weightMeasurement = value.MapTo();

            if (weightMeasurement == null)
            {
                return(BadRequest("Unable to process the request."));
            }
            else if (weightMeasurement.Unit == WeightMeasurement.Units.None)
            {
                return(BadRequest("Unable to process the request. Units were not properly defined. Acceptable values are: " + Enum <WeightMeasurement.Units> .GetValuesAsCSV()));
            }
            else
            {
                weightMeasurement.Id = parsedId;
            }

            var updateMask = this.GetJsonPropertyNameFields(typeof(WeightUpdate));

            // Act
            if (!_bizLogic.Exists(weightMeasurement.Id))
            {
                return(NotFound("ID not found."));
            }

            var bizResult = _bizLogic.Update(weightMeasurement, updateMask);

            // Response
            if (bizResult.Outcome == MetrikOutcome.Ok)
            {
                WeightUpdated responseResult = WeightUpdated.MapFrom(bizResult.Artifact);
                return(Ok(responseResult));
            }

            return(ParseMetrikResultIntoActionResult(bizResult));
        }