public async Task <IActionResult> AddLongAttribute([FromBody] LongAttributeInput attributeInput) { if (!ModelState.IsValid) { string errors = JsonConvert.SerializeObject(ModelState.Values .SelectMany(state => state.Errors) .Select(error => error.ErrorMessage)); throw new BadInputException(101, errors); } int userId = User.GetUserId(); var attribute = await attributeService.AddLongAttribute(userId, attributeInput); var attributeVM = mapper.Map <CreatedAttributeVM>(attribute); return(Created($"/api/long_attributes/{attribute.Id}", attributeVM)); }