Index: trunk/sources/HeuristicLab.DataAccess/3.2/HeuristicLab.DataAccess-3.2.csproj
===================================================================
--- trunk/sources/HeuristicLab.DataAccess/3.2/HeuristicLab.DataAccess-3.2.csproj	(revision 1596)
+++ trunk/sources/HeuristicLab.DataAccess/3.2/HeuristicLab.DataAccess-3.2.csproj	(revision 1597)
@@ -95,4 +95,5 @@
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="Interfaces\IPolymorphicDataAdapter.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="DataAccessPlugin.cs" />
Index: trunk/sources/HeuristicLab.DataAccess/3.2/Interfaces/IPolymorphicDataAdapter.cs
===================================================================
--- trunk/sources/HeuristicLab.DataAccess/3.2/Interfaces/IPolymorphicDataAdapter.cs	(revision 1597)
+++ trunk/sources/HeuristicLab.DataAccess/3.2/Interfaces/IPolymorphicDataAdapter.cs	(revision 1597)
@@ -0,0 +1,49 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace HeuristicLab.DataAccess.Interfaces {
+  public interface IPolymorphicDataAdapter<ObjT>: IDataAdapter<ObjT>
+    where ObjT: IPersistableObject
+  {
+    /// <summary>
+    /// Save or update the object
+    /// </summary>
+    /// <param name="user"></param>
+    void UpdatePolymorphic(ObjT obj);
+
+    /// <summary>
+    /// Get the object with the specified ID
+    /// </summary>
+    /// <param name="userId"></param>
+    /// <returns></returns>
+    ObjT GetByIdPolymorphic(Guid id);
+
+    /// <summary>
+    /// Deletes the object
+    /// </summary>
+    /// <param name="user"></param>
+    bool DeletePolymorphic(ObjT obj);
+  }
+}
Index: trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/3.2/ClientGroupAdapter.cs
===================================================================
--- trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/3.2/ClientGroupAdapter.cs	(revision 1596)
+++ trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/3.2/ClientGroupAdapter.cs	(revision 1597)
@@ -71,16 +71,4 @@
       }
     }
-
-    private IClientAdapter clientAdapter = null;
-
-    private IClientAdapter ClientAdapter {
-      get {
-        if (clientAdapter == null)
-          clientAdapter =
-            this.Session.GetDataAdapter<ClientInfo, IClientAdapter>();
-
-        return clientAdapter;
-      }
-    }
     #endregion
 
@@ -102,16 +90,8 @@
        clientGroup.Resources.Clear();
         foreach(Guid resource in resources) {
-          ClientInfo client = 
-            ClientAdapter.GetById(resource);
+          Resource res =
+            ResAdapter.GetByIdPolymorphic(resource);
 
-          if (client == null) {
-            //client group
-            ClientGroup group =
-              GetById(resource);
-
-            clientGroup.Resources.Add(group);
-          } else {
-            clientGroup.Resources.Add(client);
-          }          
+            clientGroup.Resources.Add(res);         
         }
 
@@ -141,11 +121,5 @@
           new List<Guid>();
         foreach(Resource res in group.Resources) {
-          if (res is ClientInfo) {
-            ClientAdapter.Update(res as ClientInfo);
-          } else if (res is ClientGroup) {
-            Update(res as ClientGroup);
-          } else {
-            ResAdapter.Update(res);
-          }
+          ResAdapter.UpdatePolymorphic(res);
 
           relationships.Add(res.Id);
Index: trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/3.2/ResourceAdapter.cs
===================================================================
--- trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/3.2/ResourceAdapter.cs	(revision 1596)
+++ trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/3.2/ResourceAdapter.cs	(revision 1597)
@@ -49,4 +49,16 @@
         
         return clientAdapter;
+      }
+    }
+
+    private IClientGroupAdapter clientGroupAdapter = null;
+
+    private IClientGroupAdapter ClientGroupAdapter {
+      get {
+        if (clientGroupAdapter == null)
+          clientGroupAdapter =
+            this.Session.GetDataAdapter<ClientGroup, IClientGroupAdapter>();
+
+        return clientGroupAdapter;
       }
     }
@@ -108,4 +120,46 @@
 
     #endregion
+
+    #region IPolymorphicDataAdapter<Resource> Members
+
+    public void UpdatePolymorphic(Resource res) {
+      if (res is ClientInfo) {
+        ClientAdapter.Update(res as ClientInfo);
+      } else if (res is ClientGroup) {
+        ClientGroupAdapter.Update(res as ClientGroup);
+      } else {
+        this.Update(res);
+      }
+    }
+
+    public Resource GetByIdPolymorphic(Guid id) {
+      ClientGroup group =
+        ClientGroupAdapter.GetById(id);
+
+      if (group != null)
+        return group;
+      else {
+        ClientInfo client =
+          ClientAdapter.GetById(id);
+
+        if (client != null)
+          return client;
+        else {
+          return this.GetById(id);
+        }
+      }
+    }
+
+    public bool DeletePolymorphic(Resource res) {
+      if (res is ClientInfo) {
+        return ClientAdapter.Delete(res as ClientInfo);
+      } else if (res is ClientGroup) {
+        return ClientGroupAdapter.Delete(res as ClientGroup);
+      } else {
+        return this.Delete(res);
+      }
+    }
+
+    #endregion
   }
 }
Index: trunk/sources/HeuristicLab.Hive.Server.DataAccess/3.2/IResourceAdapter.cs
===================================================================
--- trunk/sources/HeuristicLab.Hive.Server.DataAccess/3.2/IResourceAdapter.cs	(revision 1596)
+++ trunk/sources/HeuristicLab.Hive.Server.DataAccess/3.2/IResourceAdapter.cs	(revision 1597)
@@ -30,5 +30,5 @@
   /// The resource database adapter
   /// </summary>
-  public interface IResourceAdapter: IDataAdapter<Resource> {
+  public interface IResourceAdapter: IPolymorphicDataAdapter<Resource> {
     /// <summary>
     /// Gets the resource and updates the values of the object
