ListBox Update Handling
Small Code duplication

var existUserGroups = db.Users.Where(u =&gt; u.ID == user.ID).Single().UserGroups;
var existUserGroupsIds = db.Users.Where(u =&gt; u.ID == user.ID).Single().UserGroups.Select(ug =&gt; ug.ID).ToArray&lt;int&gt;();


can be reduced to

var existUserGroups = db.Users.Where(u =&gt; u.ID == user.ID).Single().UserGroups;
var existUserGroupsIds = existUserGroups.Select(ug =&gt; ug.ID).ToArray&lt;int&gt;();


The //Add part

Should be simplified using a foreach loop and made more readable by using the Contains() method

foreach (int newId in newUserGroupsIds)
{
    if (!existUserGroupsIds.Contains(newId))
    {
        existUserGroups.Add(db.UserGroups.Where(ug =&gt; ug.ID == newId).Single());
    }
}


The //Remove part

var diff = existUserGroupsIds.Except(newUserGroupsIds);


diff will never be null => the null check can be skipped
using a for..each instead of a for loop => the check for diff.Count() &gt; 0 can be skipped

var diff = existUserGroupsIds.Except(newUserGroupsIds);
foreach (int id in diff)
{
    existUserGroups.Remove(db.UserGroups.Where(ug =&gt; ug.ID == id).Single());
}