public async Task <IActionResult> CreateCharacteristic([FromBody] ProductCharacteristicChangeSetting characteristic)
        {
            if (characteristic == null)
            {
                ModelState.AddModelError(ErrorResponses.MissingBody, string.Empty);
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var charModel = new ProductCharacteristic()
            {
                Name        = characteristic.Name,
                Description = characteristic.Description,
                Enabled     = characteristic.Enabled,
                Visible     = characteristic.Visible,
                ValueType   = characteristic.ValueType
            };
            var currentUser = await CurrentUserRetriever.GetCurrentUserAsync();

            var createCharacteristicCommand = new Jibberwock.Persistence.DataAccess.Commands.Products.CreateCharacteristic(Logger, currentUser, HttpContext.TraceIdentifier, WebApiConfiguration.Authorization.DefaultServiceId, null, charModel);

            var creationSuccessful = await createCharacteristicCommand.Execute(SqlServerDataSource);

            return(Created(string.Empty, creationSuccessful.Result));
        }
        public async Task <IActionResult> UpdateProductCharacteristic([FromRoute] int id, [FromBody] ProductCharacteristicChangeSetting updatedCharacteristic)
        {
            if (id == 0)
            {
                ModelState.AddModelError(ErrorResponses.InvalidId, string.Empty);
            }
            if (updatedCharacteristic == null)
            {
                ModelState.AddModelError(ErrorResponses.MissingBody, string.Empty);
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var charModel = new ProductCharacteristic()
            {
                Id      = id, Name = updatedCharacteristic.Name, Description = updatedCharacteristic.Description,
                Enabled = updatedCharacteristic.Enabled, Visible = updatedCharacteristic.Visible
            };
            var currentUser = await CurrentUserRetriever.GetCurrentUserAsync();

            var updateCharacteristicCommand = new Jibberwock.Persistence.DataAccess.Commands.Products.UpdateCharacteristic(Logger, currentUser, HttpContext.TraceIdentifier, WebApiConfiguration.Authorization.DefaultServiceId, null, charModel);

            var updateSuccessful = await updateCharacteristicCommand.Execute(SqlServerDataSource);

            if (updateSuccessful.Result != null)
            {
                return(Ok(updateSuccessful.Result));
            }
            else
            {
                return(NotFound());
            }
        }