public async Task <T> AddOrUpdate(T model)
        {
            if (model.Id == 0)
            {
                var dict =
                    await _dictionaryService.Get(1, 1, new SearchModel()
                {
                    Filter = DictFilter
                });

                if (dict.Total == 0)
                {
                    IDictionary newDict =
                        await _dictionaryService.AddOrUpdate(new LocalDictionary()
                    {
                        Code = _dictionaryCode
                    });
                }

                IDictionaryRow res =
                    await
                    _dictionaryRowService.AddOrUpdate(new LocalDictionaryRow()
                {
                    Id             = 0,
                    Weight         = model.Weight,
                    Value          = model.Name,
                    DictionaryCode = _dictionaryCode,
                });

                model.Id =
                    res.Id;
            }
            else
            {
                IDictionaryRow res =
                    await
                    _dictionaryRowService.AddOrUpdate(new LocalDictionaryRow()
                {
                    Id             = model.Id,
                    Weight         = model.Weight,
                    Value          = model.Name,
                    DictionaryCode = _dictionaryCode,
                });
            }

            return(model);
        }