public static void UpdateGroupContainer(GroupContainer groupsContainer, List <AssignmentItem> assignmentItems, List <UserItem> userItems, List <GroupItem> groupItems)
        {
            bool existsNotAssignedUsers = GroupUsersItemsOp.AnyNotAssignedUsers(userItems, assignmentItems);

            if (existsNotAssignedUsers)
            {
                List <UserItem> notAssignedUserItems = GroupUsersItemsOp.FindNotAssignedUsers(userItems, assignmentItems);

                GroupItem groupItem = new GroupItem(new Guid(), "Unassigned");
                groupsContainer.AddUsers(groupItem, notAssignedUserItems);

                userItems = userItems.Except(notAssignedUserItems).ToList();
            }

            foreach (AssignmentItem assignment in assignmentItems)
            {
                UserItem usersFromAssignment = userItems.First(u => u.Id == assignment.UserId);

                GroupItem groupFromAssignment = groupItems.First(u => u.Id == assignment.GroupId);

                groupsContainer.AddUser(groupFromAssignment, usersFromAssignment);
            }

            groupsContainer.AddGroups(groupItems);
        }
        public static void UpdateGroupContainer(GroupContainer groupsContainer, List <Assignment> assignments, List <User> users, List <Group> groups)
        {
            bool existsNotAssignedUsers = GroupUsersOp.AnyNotAssignedUsers(users, assignments);

            if (existsNotAssignedUsers)
            {
                List <User>     notAssignedUsers     = GroupUsersOp.FindNotAssignedUsers(users, assignments);
                List <UserItem> notAssignedUserItems =
                    notAssignedUsers.Select(u => new UserItem(u.Id, u.FullName, u.Email, new List <Guid>())).ToList();
                GroupItem groupItem = new GroupItem(new Guid(), "Unassigned");
                groupsContainer.AddUsers(groupItem, notAssignedUserItems);

                users = users.Except(notAssignedUsers).ToList();
            }

            foreach (Assignment assignment in assignments)
            {
                User     user     = users.First(u => u.Id == assignment.UserId);
                UserItem userItem = new UserItem(user.Id, user.FullName, user.Email, assignment.Id);

                Group     group     = groups.First(u => u.Id == assignment.GroupId);
                GroupItem groupItem = new GroupItem(group.Id, group.GroupName);

                groupsContainer.AddUser(groupItem, userItem);
            }

            List <GroupItem> groupItems =
                groups.Select(u => new GroupItem(u.Id, u.GroupName)).ToList();

            groupsContainer.AddGroups(groupItems);
        }
        public static void UpdateGroupContainer(GroupContainer groupsContainer, List <UserItem> userItems, List <GroupItem> groupItems)
        {
            bool existsNotAssignedUsers = userItems.Any(u => u.AssignmentIds.Any() == false);

            if (existsNotAssignedUsers)
            {
                List <UserItem> notAssignedUserItems = userItems.Where(u => u.AssignmentIds.Any() == false).ToList();

                GroupItem groupItem = new GroupItem(new Guid(), "Unassigned");
                groupsContainer.AddUsers(groupItem, notAssignedUserItems);

                userItems = userItems.Except(notAssignedUserItems).ToList();
            }

            foreach (GroupItem groupItem in groupItems)
            {
                UserItem usersFromGroup = userItems.First(u => u.AssignmentIds.Any(a => a.GroupId == groupItem.Id));

                groupsContainer.AddUser(groupItem, usersFromGroup);
            }

            groupsContainer.AddGroups(groupItems);
        }