public async Task <IActionResult> Create([FromBody] SaveOptionJson json)
        {
            var catalog = new OptionCatalog(_dbContext, _messageBroker);

            var option = json.MapTo(new Option
            {
                TenantId = User.Claims.TenantId()
            });

            await catalog.Add(option);

            if (catalog.GroupNotExists)
            {
                return(new OptionGroupNotFoundError());
            }

            return(new OptionJson(catalog.Option));
        }
        public async Task <IActionResult> Update([FromRoute] long id,
                                                 [FromBody] SaveOptionJson json)
        {
            var catalog  = new OptionCatalog(_dbContext, _messageBroker);
            var tenantId = User.Claims.TenantId();

            await catalog.Find(tenantId, id);

            if (catalog.OptionNotExists)
            {
                return(new OptionNotFoundError());
            }

            json.MapTo(catalog.Option);

            await catalog.Update();

            if (catalog.GroupNotExists)
            {
                return(new OptionGroupNotFoundError());
            }

            return(new OptionJson(catalog.Option));
        }