Index: /trunk/sources/HeuristicLab.Hive.Contracts/BusinessObjects/PermissionOwner.cs
===================================================================
--- /trunk/sources/HeuristicLab.Hive.Contracts/BusinessObjects/PermissionOwner.cs	(revision 938)
+++ /trunk/sources/HeuristicLab.Hive.Contracts/BusinessObjects/PermissionOwner.cs	(revision 939)
@@ -34,5 +34,16 @@
     [DataMember]
     public string Name { get; set; }
-    
+
+    public override bool Equals(object obj) {
+      if (obj is PermissionOwner) 
+        return this.PermissionOwnerId.Equals(
+          (obj as PermissionOwner).PermissionOwnerId);
+      else
+        return base.Equals(obj);
+    }
+
+    public override int GetHashCode() {
+      return this.PermissionOwnerId.GetHashCode();
+    }
   }
 }
Index: /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/PermissionOwnerAdapter.cs
===================================================================
--- /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/PermissionOwnerAdapter.cs	(revision 938)
+++ /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/PermissionOwnerAdapter.cs	(revision 939)
@@ -152,5 +152,5 @@
           if(row != null) {
             data.RemovePermissionOwnerRow(row);
-
+          
             return true;
           }
Index: /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/UserAdapter.cs
===================================================================
--- /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/UserAdapter.cs	(revision 938)
+++ /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/UserAdapter.cs	(revision 939)
@@ -39,4 +39,6 @@
     private IPermissionOwnerAdapter permOwnerAdapter =
        ServiceLocator.GetPermissionOwnerAdapter();
+
+    private IUserGroupAdapter userGroupAdapter = null;
 
     public UserAdapter() {
@@ -150,4 +152,16 @@
 
         if (row != null) {
+          if (userGroupAdapter == null)
+            userGroupAdapter =
+              ServiceLocator.GetUserGroupAdapter();
+
+          ICollection<UserGroup> userGroups =
+            userGroupAdapter.MemberOf(user);
+
+          foreach (UserGroup group in userGroups) {
+            group.Members.Remove(user);
+            userGroupAdapter.UpdateUserGroup(group);
+          }
+
           data.RemoveHiveUserRow(row);
 
Index: /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/UserGroupAdapter.cs
===================================================================
--- /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/UserGroupAdapter.cs	(revision 938)
+++ /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/UserGroupAdapter.cs	(revision 939)
@@ -28,4 +28,5 @@
 using HeuristicLab.Hive.Contracts.BusinessObjects;
 using System.Runtime.CompilerServices;
+using System.Data;
 
 namespace HeuristicLab.Hive.Server.ADODataAccess {
@@ -169,6 +170,14 @@
         foreach (dsHiveServer.PermissionOwner_UserGroupRow permOwnerUserGroupRow in
           userGroupRows) {
-          PermissionOwner permOwner = userGroup.Members.Single<PermissionOwner>(
-            p => p.PermissionOwnerId == permOwnerUserGroupRow.PermissionOwnerId);
+          PermissionOwner permOwner = null;
+
+          IEnumerable<PermissionOwner> permOwners =
+            from p in
+              userGroup.Members
+            where p.PermissionOwnerId == permOwnerUserGroupRow.PermissionOwnerId
+            select p;
+
+          if (permOwners.Count<PermissionOwner>() == 1)
+            permOwner = permOwners.First<PermissionOwner>();
 
           if (permOwner == null) {
@@ -234,4 +243,26 @@
 
       return allUserGroups;
+    }
+
+    public ICollection<UserGroup> MemberOf(PermissionOwner permOwner) {
+      ICollection<UserGroup> userGroups =
+        new List<UserGroup>();
+      
+      if (permOwner != null) {
+        IEnumerable<dsHiveServer.PermissionOwner_UserGroupRow> userGroupRows =
+         from userGroup in
+           permOwnerUserGroupData.AsEnumerable<dsHiveServer.PermissionOwner_UserGroupRow>()
+         where userGroup.PermissionOwnerId == permOwner.PermissionOwnerId
+         select userGroup;
+
+        foreach (dsHiveServer.PermissionOwner_UserGroupRow userGroupRow in
+          userGroupRows) {
+          UserGroup userGroup = 
+            GetUserGroupById(userGroupRow.UserGroupId);
+          userGroups.Add(userGroup);
+        }
+      }
+
+      return userGroups;
     }
 
@@ -249,5 +280,5 @@
             permOwnerUserGroupData) {
             if (permOwnerUserGroupRow.UserGroupId == group.PermissionOwnerId || 
-                permOwnerUserGroupRow.PermissionOwnerId == group.PermissionOwnerId) {
+              permOwnerUserGroupRow.PermissionOwnerId == group.PermissionOwnerId) {
               deleted.Add(permOwnerUserGroupRow);
             }
Index: /trunk/sources/HeuristicLab.Hive.Server.Core/DbTestApp.cs
===================================================================
--- /trunk/sources/HeuristicLab.Hive.Server.Core/DbTestApp.cs	(revision 938)
+++ /trunk/sources/HeuristicLab.Hive.Server.Core/DbTestApp.cs	(revision 939)
@@ -114,4 +114,8 @@
       user2.Name = "Martin";
 
+      User user3 =
+        new User();
+      user3.Name = "Heinz";
+
       UserGroup group =
         new UserGroup();
@@ -121,4 +125,5 @@
       subGroup.Members.Add(user);
 
+      group.Members.Add(user3);
       group.Members.Add(user2);
       group.Members.Add(subGroup);
@@ -132,11 +137,19 @@
         userGroupAdapter.GetAllUserGroups();
 
+      IUserAdapter userAdapter =
+        ServiceLocator.GetUserAdapter();
+
+      userAdapter.DeleteUser(user3);
+      
+      read =
+         userGroupAdapter.GetUserGroupById(group.PermissionOwnerId);
+
       userGroupAdapter.DeleteUserGroup(subGroup);
+
+      read =
+         userGroupAdapter.GetUserGroupById(group.PermissionOwnerId);
 
       userGroups =
         userGroupAdapter.GetAllUserGroups();
-
-      read =
-        userGroupAdapter.GetUserGroupById(group.PermissionOwnerId);
 
       userGroupAdapter.DeleteUserGroup(group);
@@ -144,7 +157,4 @@
       userGroups =
         userGroupAdapter.GetAllUserGroups();
-
-      IUserAdapter userAdapter =
-        ServiceLocator.GetUserAdapter();
 
       userAdapter.DeleteUser(user);
Index: /trunk/sources/HeuristicLab.Hive.Server.Core/InternalInterfaces/DataAccess/IUserGroupAdapter.cs
===================================================================
--- /trunk/sources/HeuristicLab.Hive.Server.Core/InternalInterfaces/DataAccess/IUserGroupAdapter.cs	(revision 938)
+++ /trunk/sources/HeuristicLab.Hive.Server.Core/InternalInterfaces/DataAccess/IUserGroupAdapter.cs	(revision 939)
@@ -51,4 +51,11 @@
 
     /// <summary>
+    /// Gets all user groups where the permission owner is member of
+    /// </summary>
+    /// <param name="permOwner"></param>
+    /// <returns></returns>
+    ICollection<UserGroup> MemberOf(PermissionOwner permOwner);
+
+    /// <summary>
     /// Deletes the user group
     /// </summary>
