///<summary>Manually sync the database on the lists passed in. This does not check the PKs of the items in either list.
        ///Instead, it only cares about info in the UserGroupNum and UserNum columns.
        ///Returns the number of rows that were changed. Currently only used in the CEMT tool.</summary>
        public static long SyncCEMT(List <UserGroupAttach> listNew, List <UserGroupAttach> listOld)
        {
            //This remoting role check isn't necessary but will save on network traffic
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetLong(MethodBase.GetCurrentMethod(), listNew, listOld));
            }
            //the users and usergroups in listNew correspond to UserNumCEMTs and UserGroupNumCEMTs.

            // - If a row with the same UserGroupNum and UserNum exists in ListNew that does not exist in list Old, add it to listAdd.
            // - If a row with the same UserGroupNum and UserNum exists in ListOld that does not exist in ListNew, add it to listDel.
            List <UserGroupAttach> listAdd = new List <UserGroupAttach>();
            List <UserGroupAttach> listDel = new List <UserGroupAttach>();
            long rowsChanged = 0;

            foreach (UserGroupAttach userGroupAtt in listNew)
            {
                if (!listOld.Exists(x => x.UserGroupNum == userGroupAtt.UserGroupNum && x.UserNum == userGroupAtt.UserNum))
                {
                    listAdd.Add(userGroupAtt);
                }
            }
            foreach (UserGroupAttach userGroupAtt in listOld)
            {
                if (!listNew.Exists(x => x.UserGroupNum == userGroupAtt.UserGroupNum && x.UserNum == userGroupAtt.UserNum))
                {
                    listDel.Add(userGroupAtt);
                }
            }
            //make sure that there is only one unique (UserGroup, UserGroupNum) row in the add list. (this is precautionary)
            listAdd = listAdd.GroupBy(x => new { x.UserNum, x.UserGroupNum }).Select(x => x.First()).ToList();
            //Get users and user groups from remote db to compare against for log entrys
            List <Userod>    listRemoteUsers  = Userods.GetUsersNoCache();
            List <UserGroup> listRemoteGroups = UserGroups.GetCEMTGroupsNoCache();

            foreach (UserGroupAttach userGroupAdd in listAdd)
            {
                rowsChanged++;
                UserGroupAttaches.Insert(userGroupAdd);
                Userod    user      = listRemoteUsers.FirstOrDefault(x => x.UserNum == userGroupAdd.UserNum);
                UserGroup userGroup = listRemoteGroups.FirstOrDefault(x => x.UserGroupNum == userGroupAdd.UserGroupNum);
                SecurityLogs.MakeLogEntryNoCache(Permissions.SecurityAdmin, 0, "User: "******" added to user group: "
                                                 + userGroup.Description + " by CEMT user: "******"User: "******" removed from user group: "
                                                 + userGroup.Description + " by CEMT user: " + Security.CurUser.UserName);
            }
            return(rowsChanged);
        }