public async Task <IActionResult> Search(SearchSettingFormCommand command)
        {
            var spec = SettingFormSpecs.SearchByQuery(command.Query);

            if (command.TableId != Guid.Empty)
            {
                spec.And(SettingFormSpecs.SearchByTableId(command.TableId));
            }
            var queryable = _settingFormRepository.QueryAsync(spec, command.Sorts);
            var items     = await queryable.Skip(command.Skip).Take(command.Take).ToListAsync();

            return(Ok(new QueryResult <SettingFormCommand>
            {
                Count = queryable.Count(),
                Items = items.To <List <SettingFormCommand> >()
            }));
        }
        public async Task <IActionResult> Create([FromBody] SettingFormCommand command)
        {
            var spec      = SettingFormSpecs.GetByNameSpec(command.Name);
            var isInvalid = await _settingFormRepository.ExistsAsync(spec);

            if (isInvalid)
            {
                throw new CellException("Setting form name mus be unique");
            }
            var settingForm = command.To <SettingForm>();

            _settingFormRepository.Add(new SettingForm(
                                           settingForm.Name,
                                           settingForm.Description,
                                           settingForm.LayoutId,
                                           JsonConvert.SerializeObject(command.Settings),
                                           settingForm.TableId,
                                           settingForm.TableName));
            await _settingFormRepository.CommitAsync();

            return(Ok());
        }