public async Task <IActionResult> Add([FromBody] NewRegulationModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ErrorResponse.Create("Invalid model.", ModelState)));
            }

            var regulation = Mapper.Map <Core.Domain.Regulation>(model);

            try
            {
                await _regulationService.AddAsync(regulation);
            }
            catch (ServiceException exception)
            {
                _log.Error(nameof(Add), exception, $"{nameof(model)}: {model.ToJson()}. IP: {HttpContext.GetIp()}");

                return(BadRequest(ErrorResponse.Create(exception.Message)));
            }

            _log.Info(nameof(Add), $"Regulation added. {nameof(model)}: {model.ToJson()}. IP: {HttpContext.GetIp()}",
                      model.Id);

            return(NoContent());
        }
        public async Task <IActionResult> PostAsync([FromBody] RegulationInputModel model)
        {
            if (ModelState.IsValid)
            {
                var regulation = new Regulation(model.Description);
                await _regulationService.AddAsync(regulation);

                if (ValidOperation())
                {
                    return(Created(GetRouteById(regulation.Id), new { id = regulation.Id }));
                }

                return(ResponseInvalid());
            }

            NotifyModelStateError();

            return(ResponseInvalid());
        }