public async Task <int> UpdateGroupsAsync(int groupId, GroupsModel model)
        {
            using (var dataService = DataServiceFactory.CreateDataService())
            {
                var Groups = groupId > 0 ? await dataService.GetGroupsAsync(model.GroupId) : new Groups();

                if (Groups != null)
                {
                    UpdateGroupsFromModel(Groups, model);
                    await dataService.UpdateGroupsAsync(groupId, Groups);

                    model.Merge(await GetGroupsAsync(dataService, Groups.GroupId));
                }
                return(0);
            }
        }
        public async Task <int> AddGroupsAsync(GroupsModel model)
        {
            long id = model.GroupId;

            using (var dataService = DataServiceFactory.CreateDataService())
            {
                var groups = new Groups();
                if (groups != null)
                {
                    UpdateGroupsFromModel(groups, model);

                    await dataService.AddGroupsAsync(groups);

                    model.Merge(await GetGroupsAsync(dataService, groups.GroupId));
                }
                return(0);
            }
        }