Index: branches/ClientManagement/HeuristicLab.Services.Authentication/HeuristicLab.Services.Authentication.DataTransfer/Client.cs
===================================================================
--- branches/ClientManagement/HeuristicLab.Services.Authentication/HeuristicLab.Services.Authentication.DataTransfer/Client.cs	(revision 5004)
+++ branches/ClientManagement/HeuristicLab.Services.Authentication/HeuristicLab.Services.Authentication.DataTransfer/Client.cs	(revision 5335)
@@ -1,22 +1,20 @@
 ﻿using System.Runtime.Serialization;
 
-namespace HeuristicLab.Services.Authentication.DataTransfer
-{
-    [DataContract]
-    public class Client : HeuristicLab.Services.Authentication.DataTransfer.Resource
-    {
-        [DataMember]
-        public string ProcessorType { get; set; }
-        [DataMember]
-        public string NumberOfProcessors { get; set; }
-        [DataMember]
-        public string NumberOfThreads { get; set; }
-        [DataMember]
-        public string IPAdress { get; set; }
-        [DataMember]
-        public string MemorySize { get; set; }
-        [DataMember]
-        public string OperatingSystem { get; set; }
+namespace HeuristicLab.Services.Authentication.DataTransfer {
+  [DataContract]
+  public class Client : HeuristicLab.Services.Authentication.DataTransfer.Resource {
+    [DataMember]
+    public string ProcessorType { get; set; }
+    [DataMember]
+    public string NumberOfProcessors { get; set; }
+    [DataMember]
+    public string NumberOfThreads { get; set; }
+    [DataMember]
+    public string IPAdress { get; set; }
+    [DataMember]
+    public string MemorySize { get; set; }
+    [DataMember]
+    public string OperatingSystem { get; set; }
 
-    }
+  }
 }
Index: branches/ClientManagement/HeuristicLab.Services.Authentication/HeuristicLab.Services.Authentication.DataTransfer/Resource.cs
===================================================================
--- branches/ClientManagement/HeuristicLab.Services.Authentication/HeuristicLab.Services.Authentication.DataTransfer/Resource.cs	(revision 5004)
+++ branches/ClientManagement/HeuristicLab.Services.Authentication/HeuristicLab.Services.Authentication.DataTransfer/Resource.cs	(revision 5335)
@@ -1,20 +1,21 @@
 ﻿using System.Runtime.Serialization;
+using System.Collections.Generic;
 
-namespace HeuristicLab.Services.Authentication.DataTransfer
-{
-    [DataContract]
-    public abstract class Resource
-    {
-        [DataMember]
-        public System.Guid Id { get; set; }
-        [DataMember]
-        public string Name { get; set; }
-        [DataMember]
-        public string Description { get; set; }
-        [DataMember]
-        public string ResourceType { get; set; }
-        [DataMember]
-        public System.Guid ResourceGroup { get; set; }
-    }
+namespace HeuristicLab.Services.Authentication.DataTransfer {
+  [DataContract]
+  public abstract class Resource {
+    public enum ResourceTypes { Client, ResourceGroup };
+
+    [DataMember]
+    public System.Guid Id { get; set; }
+    [DataMember]
+    public string Name { get; set; }
+    [DataMember]
+    public string Description { get; set; }
+    [DataMember]
+    public ResourceTypes ResourceType { get; set; }
+    [DataMember]
+    public IEnumerable<System.Guid> ResourceGroup { get; set; }
+  }
 }
 
Index: branches/ClientManagement/HeuristicLab.Services.Authentication/HeuristicLab.Services.Authentication.DataTransfer/ResourceGroup.cs
===================================================================
--- branches/ClientManagement/HeuristicLab.Services.Authentication/HeuristicLab.Services.Authentication.DataTransfer/ResourceGroup.cs	(revision 5004)
+++ branches/ClientManagement/HeuristicLab.Services.Authentication/HeuristicLab.Services.Authentication.DataTransfer/ResourceGroup.cs	(revision 5335)
@@ -1,10 +1,8 @@
 ﻿using System.Runtime.Serialization;
 
-namespace HeuristicLab.Services.Authentication.DataTransfer
-{
-    [DataContract]
-    public class ResourceGroup : Resource
-    {
-    }
+namespace HeuristicLab.Services.Authentication.DataTransfer {
+  [DataContract]
+  public class ResourceGroup : Resource {
+  }
 }
 
Index: branches/ClientManagement/HeuristicLab.Services.Authentication/HeuristicLab.Services.Authentication/AuthenticationService.cs
===================================================================
--- branches/ClientManagement/HeuristicLab.Services.Authentication/HeuristicLab.Services.Authentication/AuthenticationService.cs	(revision 5335)
+++ branches/ClientManagement/HeuristicLab.Services.Authentication/HeuristicLab.Services.Authentication/AuthenticationService.cs	(revision 5335)
@@ -0,0 +1,256 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.Services.Authentication.DataAccess;
+using DA = HeuristicLab.Services.Authentication.DataAccess;
+using DT = HeuristicLab.Services.Authentication.DataTransfer;
+
+
+namespace HeuristicLab.Services.Authentication {
+
+  public class AuthenticationService : IAuthenticationService {
+
+    public DataTransfer.Client GetClient(Guid id) {
+      using (ClientManagmentDataContext cmdc = new ClientManagmentDataContext()) {
+        DT.Client client = Convert.ToDto(cmdc.Resources.OfType<DA.Client>().FirstOrDefault(x => x.Id == id));
+        if (client != null) {
+          var groups = cmdc.ResourceResourceGroups.Where(x => x.ResourceId == id).Select(x => x.ResourceGroupId).ToArray();
+          client.ResourceGroup = groups;
+        }
+        return client;
+      }
+    }
+
+    public IEnumerable<DataTransfer.Client> GetClients() {
+      using (ClientManagmentDataContext cmdc = new ClientManagmentDataContext()) {
+        List<DT.Client> allClients = new List<DT.Client>();
+        foreach (DA.Client dbClient in cmdc.Resources.OfType<DA.Client>()) {
+          DT.Client client = Convert.ToDto(dbClient);
+          ////////if (client != null) {
+          ////////  DA.ResourceResourceGroup rrg = cmdc.ResourceResourceGroups.FirstOrDefault(x => x.ResourceId == client.Id);
+          ////////  if (rrg != null)
+          ////////    //client.ResourceGroup. = rrg.ResourceGroupId;
+          ////////  allClients.Add(client);
+          ////////}
+          if (client != null) {
+            var groups = cmdc.ResourceResourceGroups.Where(x => x.ResourceId == client.Id).Select(x => x.ResourceGroupId).ToArray();
+            client.ResourceGroup = groups;
+          }
+          allClients.Add(client);
+        }
+
+        if (allClients.Count > 0)
+          return allClients;
+        return null;
+      }
+    }
+
+    public Guid AddClient(DataTransfer.Client dto) {
+      using (ClientManagmentDataContext cmdc = new ClientManagmentDataContext()) {
+        return InsertResource(cmdc, dto);
+      }
+    }
+
+
+    public void UpdateClient(DataTransfer.Client dto) {
+      using (ClientManagmentDataContext cmdc = new ClientManagmentDataContext()) {
+        DA.Client client = cmdc.Resources.OfType<DA.Client>().FirstOrDefault(x => x.Id == dto.Id);
+
+        // check if resource exists
+        if (client == null)
+          return;
+
+        UpdateResourceResourceGroup(cmdc, dto);
+
+        DA.Client entity = Convert.ToEntity(dto);
+        //entity.Id = dto.Id;
+        //entity.ResourceType = dto.ResourceType;
+        client.Name = entity.Name;
+        client.ResourceGroups = entity.ResourceGroups;
+        client.Description = entity.Description;
+        client.IPAdress = entity.IPAdress;
+        client.MemorySize = entity.MemorySize;
+        client.NumberOfProcessors = entity.NumberOfProcessors;
+        client.NumberOfThreads = entity.NumberOfThreads;
+        client.OperatingSystem = entity.OperatingSystem;
+        client.ProcessorType = entity.ProcessorType;
+
+        cmdc.SubmitChanges();
+      }
+
+    }
+
+    public void DeleteClient(DataTransfer.Client dto) {
+      using (ClientManagmentDataContext cmdc = new ClientManagmentDataContext()) {
+        RemoveResource(cmdc, dto);
+      }
+    }
+
+    public DataTransfer.ResourceGroup GetResourceGroup(Guid id) {
+      using (ClientManagmentDataContext cmdc = new ClientManagmentDataContext()) {
+        DA.ResourceGroup resourceGroup = cmdc.Resources.OfType<DA.ResourceGroup>().FirstOrDefault(x => x.Id == id);
+        return Convert.ToDto(resourceGroup);
+      }
+    }
+
+    public IEnumerable<DataTransfer.ResourceGroup> GetResourceGroupsOf(Guid id) {
+      List<DT.ResourceGroup> allResourceGroups = new List<DT.ResourceGroup>();
+      using (ClientManagmentDataContext cmdc = new ClientManagmentDataContext()) {
+        var groups = cmdc.ResourceResourceGroups.Where(x => x.ResourceId == id).Select(x => x.ResourceGroupId).ToArray();
+        foreach (Guid rId in groups)
+          allResourceGroups.Add(GetResourceGroup(rId));
+        return allResourceGroups;
+      }
+    }
+
+    public IEnumerable<DataTransfer.ResourceGroup> GetResourceGroups() {
+      using (ClientManagmentDataContext cmdc = new ClientManagmentDataContext()) {
+        List<DT.ResourceGroup> allClients = new List<DT.ResourceGroup>();
+        foreach (DA.ResourceGroup dbResourceGroup in cmdc.Resources.OfType<DA.ResourceGroup>()) {
+          DT.ResourceGroup resourceGroup = Convert.ToDto(dbResourceGroup);
+          if (resourceGroup != null)
+            allClients.Add(resourceGroup);
+        }
+        if (allClients.Count > 0)
+          return allClients;
+        return null;
+      }
+    }
+
+    public Guid AddResourceGroup(DataTransfer.ResourceGroup dto) {
+      using (ClientManagmentDataContext cmdc = new ClientManagmentDataContext()) {
+        return InsertResource(cmdc, dto);
+      }
+    }
+
+    public void UpdateResourceGroup(DataTransfer.ResourceGroup dto) {
+      using (ClientManagmentDataContext cmdc = new ClientManagmentDataContext()) {
+        DA.ResourceGroup group = cmdc.Resources.OfType<DA.ResourceGroup>().FirstOrDefault(x => x.Id == dto.Id);
+
+        // check if resource exists
+        if (group == null)
+          return;
+        
+        UpdateResourceResourceGroup(cmdc, dto);
+
+        DA.ResourceGroup entity = Convert.ToEntity(dto);
+        ////group.Id;
+        ////group.ResourceType;
+        group.Name = entity.Name;
+        //group.ResourceGroups = entity.ResourceGroups;
+        group.Description = entity.Description;
+
+        cmdc.SubmitChanges();
+      }
+    }
+
+    public void DeleteResourceGroup(DataTransfer.ResourceGroup dto) {
+      using (ClientManagmentDataContext cmdc = new ClientManagmentDataContext()) {
+        RemoveResource(cmdc, dto);
+      }
+    }
+
+    // neu
+    public IEnumerable<DataTransfer.Resource> GetMembers(Guid resourceGroupid) {
+      List<DT.Resource> allMembers = new List<DT.Resource>();
+      using (ClientManagmentDataContext cmdc = new ClientManagmentDataContext()) {
+        var members = cmdc.ResourceResourceGroups.Where(x => x.ResourceGroupId == resourceGroupid).Select(x => x.ResourceId).ToArray();
+        foreach (Guid rId in members)
+          allMembers.Add(GetClient(resourceGroupid));
+        return allMembers;
+      }
+    }
+
+    public IEnumerable<DataTransfer.Resource> GetRootResources() {
+      List<DT.ResourceGroup> rootResources = new List<DT.ResourceGroup>();
+      using (ClientManagmentDataContext cmdc = new ClientManagmentDataContext()) {
+        foreach (DA.ResourceGroup dbResourceGroup in cmdc.Resources.OfType<DA.ResourceGroup>()) {
+          var rrg = cmdc.ResourceResourceGroups.Where(x => x.ResourceId == dbResourceGroup.Id);
+          if ((rrg.Count() == 0) && 
+            (dbResourceGroup.ResourceType == DT.ResourceGroup.ResourceTypes.ResourceGroup.ToString())) {
+            DT.ResourceGroup group = Convert.ToDto(dbResourceGroup);
+            rootResources.Add(group);
+          }
+        }
+        return rootResources;
+      }
+    }
+
+    private Guid InsertResource(ClientManagmentDataContext cmdc, DT.Resource dto) {
+      List<ResourceResourceGroup> newRrgList = new List<ResourceResourceGroup>();
+      if ((dto.ResourceGroup != null) && (dto.ResourceGroup.Count() > 0)) {
+        foreach (Guid rgId in dto.ResourceGroup) {
+          ResourceGroup grp = cmdc.Resources.OfType<DA.ResourceGroup>().FirstOrDefault(x => x.Id == rgId);
+          if (grp == null)
+            return Guid.Empty;
+          ResourceResourceGroup rrg = new ResourceResourceGroup();
+          rrg.ResourceGroup = grp;
+          newRrgList.Add(rrg);
+        }
+      }
+      DA.Resource entity = Convert.ToEntity(dto);
+      if (entity != null) {
+        entity.Id = Guid.NewGuid();
+        cmdc.Resources.InsertOnSubmit(entity);
+        if (newRrgList.Count() > 0) {
+          foreach (ResourceResourceGroup rrg in newRrgList) {
+            rrg.Client = entity;
+            cmdc.ResourceResourceGroups.InsertOnSubmit(rrg);
+          }
+        }
+        cmdc.SubmitChanges();
+        return entity.Id;
+      }
+      return Guid.Empty;
+    }
+
+    private static bool RemoveResource(ClientManagmentDataContext cmdc, DT.Resource dto) {
+      RemoveRRGEntry(cmdc, dto.Id);
+      DA.Resource entity = cmdc.Resources.FirstOrDefault(x => x.Id == dto.Id);
+      if (entity != null) {
+        cmdc.Resources.DeleteOnSubmit(entity);
+        cmdc.SubmitChanges();
+        return true;
+      }
+      return false;
+    }
+
+    private static void RemoveRRGEntry(ClientManagmentDataContext cmdc, Guid resID) {
+      foreach (var rrg in cmdc.ResourceResourceGroups.Where(x => x.ResourceId == resID))
+        cmdc.ResourceResourceGroups.DeleteOnSubmit(rrg);
+      foreach (var rrg in cmdc.ResourceResourceGroups.Where(x => x.ResourceGroupId == resID)) {
+        // Begin Cascade Delete
+        RemoveRRGEntry(cmdc, rrg.Client.Id);
+        cmdc.Resources.DeleteOnSubmit(rrg.Client);
+        // End Cascade Delete
+        cmdc.ResourceResourceGroups.DeleteOnSubmit(rrg);
+      }
+    }
+
+    private void UpdateResourceResourceGroup(ClientManagmentDataContext cmdc, DataTransfer.Resource dto) {
+      //delete if no more memeber
+
+      var rrgList = cmdc.ResourceResourceGroups.Where(x => x.ResourceId == dto.Id);
+      foreach (ResourceResourceGroup rrg in rrgList) {
+        if (!dto.ResourceGroup.Contains(rrg.ResourceGroupId))
+          cmdc.ResourceResourceGroups.DeleteOnSubmit(rrg);
+      }
+
+      // insert new rrg if rrg-entry not exists
+      var rrgResourceGroupIdList = rrgList.Select(x => x.ResourceGroupId).ToArray();
+      foreach (Guid rrgResGroupId in dto.ResourceGroup) {
+        if (!rrgResourceGroupIdList.Contains(rrgResGroupId)) {
+          ResourceGroup grp = cmdc.Resources.OfType<DA.ResourceGroup>().FirstOrDefault(x => x.Id == rrgResGroupId);
+          if (grp == null)
+            return;
+          ResourceResourceGroup newRrg = new ResourceResourceGroup();
+          newRrg.ResourceId = dto.Id;
+          newRrg.ResourceGroupId = grp.Id; //=rrgResGroupId
+          cmdc.ResourceResourceGroups.InsertOnSubmit(newRrg);
+        }
+      }
+      cmdc.SubmitChanges();
+    }
+
+  }
+}
Index: branches/ClientManagement/HeuristicLab.Services.Authentication/HeuristicLab.Services.Authentication/Convert.cs
===================================================================
--- branches/ClientManagement/HeuristicLab.Services.Authentication/HeuristicLab.Services.Authentication/Convert.cs	(revision 5004)
+++ branches/ClientManagement/HeuristicLab.Services.Authentication/HeuristicLab.Services.Authentication/Convert.cs	(revision 5335)
@@ -24,117 +24,101 @@
 using DA = HeuristicLab.Services.Authentication.DataAccess;
 using DT = HeuristicLab.Services.Authentication.DataTransfer;
+using System;
 
-namespace HeuristicLab.Services.Authentication
-{
-    public static class Convert
-    {
+namespace HeuristicLab.Services.Authentication {
+  public static class Convert {
 
-        #region Client
-        public static DT.Client ToDto(DA.Client source)
-        {
-            if (source == null) return null;
-            return new DT.Client
-            {
-                Id = source.Id,
-                Name = source.Name,
-                Description = source.Description,
-                ResourceType = source.ResourceType,
-                ProcessorType = source.ProcessorType,
-                NumberOfProcessors = source.NumberOfProcessors,
-                NumberOfThreads = source.NumberOfThreads,
-                IPAdress = source.IPAdress,
-                MemorySize = source.MemorySize,
-                OperatingSystem = source.OperatingSystem
-            };
-        }
+    #region Client
+    public static DT.Client ToDto(DA.Client source) {
+      if (source == null) return null;
+      return new DT.Client {
+        Id = source.Id,
+        Name = source.Name,
+        Description = source.Description,
+        ResourceType = (DT.Resource.ResourceTypes) Enum.Parse(typeof(DT.Resource.ResourceTypes), source.ResourceType),
+        ProcessorType = source.ProcessorType,
+        NumberOfProcessors = source.NumberOfProcessors,
+        NumberOfThreads = source.NumberOfThreads,
+        IPAdress = source.IPAdress,
+        MemorySize = source.MemorySize,
+        OperatingSystem = source.OperatingSystem
+      };
+    }
 
-        public static DA.Client ToEntity(DT.Client source)
-        {
-            if (source == null) return null;
-            return new DA.Client
-            {
-                Id = source.Id,
-                Name = source.Name,
-                Description = source.Description,
-                ResourceType = source.ResourceType,
-                ProcessorType = source.ProcessorType,
-                NumberOfProcessors = source.NumberOfProcessors,
-                NumberOfThreads = source.NumberOfThreads,
-                IPAdress = source.IPAdress,
-                MemorySize = source.MemorySize,
-                OperatingSystem = source.OperatingSystem
-            };
-        }
+    public static DA.Client ToEntity(DT.Client source) {
+      if (source == null) return null;
+      return new DA.Client {
+        Id = source.Id,
+        Name = source.Name,
+        Description = source.Description,
+        ResourceType = source.ResourceType.ToString(),
+        ProcessorType = source.ProcessorType,
+        NumberOfProcessors = source.NumberOfProcessors,
+        NumberOfThreads = source.NumberOfThreads,
+        IPAdress = source.IPAdress,
+        MemorySize = source.MemorySize,
+        OperatingSystem = source.OperatingSystem
+      };
+    }
 
-        public static DA.Resource ToEntity(DT.Resource source)
-        {
-            if (source == null) return null;
-            if (source is DT.Client)
-            {
-                DT.Client client = (Client) source;
-                return ToEntity(client);
-            }
-            if (source is DT.ResourceGroup)
-            {
-                DT.ResourceGroup resourceGroup = (ResourceGroup) source;
-                return ToEntity(resourceGroup);
-            }
-            return null;
-        }
+    public static DA.Resource ToEntity(DT.Resource source) {
+      if (source == null) return null;
+      if (source is DT.Client) {
+        DT.Client client = (Client)source;
+        return ToEntity(client);
+      }
+      if (source is DT.ResourceGroup) {
+        DT.ResourceGroup resourceGroup = (ResourceGroup)source;
+        return ToEntity(resourceGroup);
+      }
+      return null;
+    }
 
-        public static void ToEntity(DT.Client source, DA.Client target)
-        {
-            if ((source != null) && (target != null))
-            {
-                target.Id = source.Id;
-                target.Name = source.Name;
-                target.Description = source.Description;
-                target.ResourceType = source.ResourceType;
-                target.ProcessorType = source.ProcessorType;
-                target.NumberOfProcessors = source.NumberOfProcessors;
-                target.NumberOfThreads = source.NumberOfThreads;
-                target.IPAdress = source.IPAdress;
-                target.MemorySize = source.MemorySize;
-                target.OperatingSystem = source.OperatingSystem;
-            }
-        }
-        #endregion // Client
+    public static void ToEntity(DT.Client source, DA.Client target) {
+      if ((source != null) && (target != null)) {
+        target.Id = source.Id;
+        target.Name = source.Name;
+        target.Description = source.Description;
+        target.ResourceType = source.ResourceType.ToString();
+        target.ProcessorType = source.ProcessorType;
+        target.NumberOfProcessors = source.NumberOfProcessors;
+        target.NumberOfThreads = source.NumberOfThreads;
+        target.IPAdress = source.IPAdress;
+        target.MemorySize = source.MemorySize;
+        target.OperatingSystem = source.OperatingSystem;
+      }
+    }
+    #endregion // Client
 
-        #region ResourceGroup
-        public static DT.ResourceGroup ToDto(DA.ResourceGroup source)
-        {
-            if (source == null) return null;
-            return new DT.ResourceGroup
-            {
-                Id = source.Id,
-                Name = source.Name,
-                Description = source.Description,
-                ResourceType = source.ResourceType,
-            };
-        }
+    #region ResourceGroup
+    public static DT.ResourceGroup ToDto(DA.ResourceGroup source) {
+      if (source == null) return null;
+      return new DT.ResourceGroup {
+        Id = source.Id,
+        Name = source.Name,
+        Description = source.Description,
+        ResourceType = (DT.Resource.ResourceTypes)Enum.Parse(typeof(DT.Resource.ResourceTypes), source.ResourceType)
+      };
+    }
 
-        public static DA.ResourceGroup ToEntity(DT.ResourceGroup source)
-        {
-            if (source == null) return null;
-            return new DA.ResourceGroup
-            {
-                Id = source.Id,
-                Name = source.Name,
-                Description = source.Description,
-                ResourceType = source.ResourceType,
-            };
-        }
+    public static DA.ResourceGroup ToEntity(DT.ResourceGroup source) {
+      if (source == null) return null;
+      return new DA.ResourceGroup {
+        Id = source.Id,
+        Name = source.Name,
+        Description = source.Description,
+        ResourceType = source.ResourceType.ToString()
+      };
+    }
 
-        public static void ToEntity(DT.ResourceGroup source, DA.ResourceGroup target)
-        {
-            if ((source != null) && (target != null))
-            {
-                target.Id = source.Id;
-                target.Name = source.Name;
-                target.Description = source.Description;
-                target.ResourceType = source.ResourceType;
-            }
-        }
-        #endregion // ResourceGroup
+    public static void ToEntity(DT.ResourceGroup source, DA.ResourceGroup target) {
+      if ((source != null) && (target != null)) {
+        target.Id = source.Id;
+        target.Name = source.Name;
+        target.Description = source.Description;
+        target.ResourceType = source.ResourceType.ToString();
+      }
     }
+    #endregion // ResourceGroup
+  }
 }
Index: branches/ClientManagement/HeuristicLab.Services.Authentication/HeuristicLab.Services.Authentication/HeuristicLab.Services.Authentication.csproj
===================================================================
--- branches/ClientManagement/HeuristicLab.Services.Authentication/HeuristicLab.Services.Authentication/HeuristicLab.Services.Authentication.csproj	(revision 5004)
+++ branches/ClientManagement/HeuristicLab.Services.Authentication/HeuristicLab.Services.Authentication/HeuristicLab.Services.Authentication.csproj	(revision 5335)
@@ -64,5 +64,5 @@
   </ItemGroup>
   <ItemGroup>
-    <Content Include="ClientService.svc" />
+    <Content Include="HeuristicLabServicesDemo.sln" />
     <Content Include="Web.config" />
     <Content Include="Web.Debug.config">
@@ -74,10 +74,7 @@
   </ItemGroup>
   <ItemGroup>
-    <Compile Include="ClientService.cs" />
+    <Compile Include="AuthenticationService.cs" />
     <Compile Include="Convert.cs" />
-    <Compile Include="ClientService.svc.cs">
-      <DependentUpon>ClientService.svc</DependentUpon>
-    </Compile>
-    <Compile Include="Interfaces\IClientService.cs" />
+    <Compile Include="Interfaces\IAuthenticationService.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
   </ItemGroup>
Index: branches/ClientManagement/HeuristicLab.Services.Authentication/Test/Program.cs
===================================================================
--- branches/ClientManagement/HeuristicLab.Services.Authentication/Test/Program.cs	(revision 5004)
+++ branches/ClientManagement/HeuristicLab.Services.Authentication/Test/Program.cs	(revision 5335)
@@ -1,70 +1,211 @@
 ﻿using System;
+using System.Text;
 using System.Collections.Generic;
 using System.Linq;
-using System.Text;
+
 using HeuristicLab.Services.Authentication;
+using HL = HeuristicLab.Services.Authentication;
 using DA = HeuristicLab.Services.Authentication.DataAccess;
 using DT = HeuristicLab.Services.Authentication.DataTransfer;
-
-namespace Test
-{
-    class Program
-    {
-        static void Main(string[] args)
-        {
-
-            //DA.ClientManagmentDataContext dc = new DA.ClientManagmentDataContext(@"Data Source=.\SQL2008;Initial Catalog=HeuristicLab.ClientManagment;Integrated Security=True");
-            DA.ClientManagmentDataContext dc = new DA.ClientManagmentDataContext();
-
-            //if (dc.DatabaseExists())
-            //{
-            //    Console.WriteLine("DB exsits");
-            //    dc.DeleteDatabase();
-            //    dc.SubmitChanges();
-            //    Console.WriteLine("DB deleted");
-            //}
-            //Console.WriteLine("DB create");
-            //dc.CreateDatabase();
-            //dc.SubmitChanges();
-            //Console.WriteLine("Finished");
-
-            ClientService cs = new ClientService();
-
-            DT.Client c = new DT.Client();
-
-            c.Id = Guid.NewGuid();
-            c.Name = "Eagle-Eye";
-            c.Description = "Development-PC";
-            c.IPAdress = "192.168.0.1";
-
-            //c.ResourceType = "Client";
-            DT.ResourceGroup r = new DT.ResourceGroup();
-            r.Name = "test";
-
-            r.Id = cs.AddResourceGroup(r);
-
-            c.ResourceGroup = r.Id;
-            c.Id = cs.AddClient(c);
-           
-            //ResourceResourceGroup rrg = new ResourceResourceGroup();
-            //rrg.ResourceGroup = r;
-            //rrg.Client = c;
-            
-            
-            //dc.GetTable<Resource>().InsertOnSubmit(r);
-            //dc.GetTable<Resource>().InsertOnSubmit(c);
-
-            //dc.GetTable<ResourceResourceGroup>().InsertOnSubmit(rrg);
-
-            //dc.SubmitChanges();
-
-           
-           // cs.GetClients();
-
-            //cs.DeleteClient(c);
-           cs.DeleteResourceGroup(r);
-
-
-        }
+using System.Data;
+using System.Data.Common;
+using System.Data.Linq;
+using System.Collections;
+
+namespace Test {
+  class Program {
+    static void Main(string[] args) {
+
+      //// //DA.ClientManagmentDataContext dc = new DA.ClientManagmentDataContext(@"Data Source=.\SQL2008;Initial Catalog=HeuristicLab.ClientManagment;Integrated Security=True");
+      //// DA.ClientManagmentDataContext dc = new DA.ClientManagmentDataContext();
+
+      //// if (dc.DatabaseExists()) {
+      ////   Console.WriteLine("DB exsits");
+      ////   dc.DeleteDatabase();
+      ////   dc.SubmitChanges();
+      ////   Console.WriteLine("DB deleted");
+      //// }
+      //// Console.WriteLine("DB create");
+      //// dc.CreateDatabase();
+      //// dc.SubmitChanges();
+      //// Console.WriteLine("Finished");
+
+      //// AuthenticationService cs = new AuthenticationService();
+
+      //// DT.Client c = new DT.Client();
+
+      //// c.Id = Guid.NewGuid();
+      //// c.Name = "Eagle-Eye";
+      //// c.Description = "Development-PC";
+      //// c.IPAdress = "192.168.0.1";
+
+      //// //c.ResourceType = "Client";
+      //// DT.ResourceGroup r = new DT.ResourceGroup();
+      //// r.Name = "test";
+
+      //// //r.Id = cs.AddResourceGroup(r);
+
+      //// //c.ResourceGroup = r.Id;
+      //// //c.Id = cs.AddClient(c);
+
+      //// //ResourceResourceGroup rrg = new ResourceResourceGroup();
+      //// //rrg.ResourceGroup = r;
+      //// //rrg.Client = c;
+
+
+      //// //dc.GetTable<Resource>().InsertOnSubmit(r);
+      //// //dc.GetTable<Resource>().InsertOnSubmit(c);
+
+      //// //dc.GetTable<ResourceResourceGroup>().InsertOnSubmit(rrg);
+
+      //// //dc.SubmitChanges();
+
+
+      ////// cs.GetClients();
+
+      //// //cs.DeleteClient(c);
+      ////cs.DeleteResourceGroup(r);
+      //Guid groupID1 = Guid.NewGuid();
+      //string groupName1 = "groupName1";
+      //Guid groupID2 = Guid.NewGuid();
+      //string groupName2 = "groupName2";
+      //Guid groupID3 = Guid.NewGuid();
+      //string groupName3 = "groupName3";
+
+      //Guid clientID1 = Guid.NewGuid();
+      //string clientName1 = "clientName1";
+      //Guid clientID2 = Guid.NewGuid();
+      //string clientName2 = "clientName2";
+
+      //DA.ClientManagmentDataContext dc = null;
+
+      //DT.Client cl1 = null;
+      //DT.Client cl2 = null;
+      //DT.Client cl3 = null;
+
+      //DT.ResourceGroup rg1 = null;
+      //DT.ResourceGroup rg2 = null;
+      //DT.ResourceGroup rg3 = null;
+
+      //DA.ResourceResourceGroup rrg1 = null;
+      //DA.ResourceResourceGroup rrg2 = null;
+      //DA.ResourceResourceGroup rrg3 = null;
+
+      //dc = new DA.ClientManagmentDataContext();
+      //if (dc.DatabaseExists()) {
+      //  //dc.DeleteDatabase();
+      //  dc.ExecuteCommand("delete from ResourceResourceGroup");
+      //  dc.ExecuteCommand("delete from Resource");
+      //  dc.SubmitChanges();
+      //}
+      //else {
+      //  dc.CreateDatabase();
+      //  dc.SubmitChanges();
+      //}
+
+
+      //// create groups
+      //rg1 = new DT.ResourceGroup();
+      //rg1.Name = groupName1;
+      //rg1.Id = groupID1;
+      //rg1.Description = "descr rg1";
+      //dc.GetTable<DA.Resource>().InsertOnSubmit(HL.Convert.ToEntity(rg1));
+
+      //rg2 = new DT.ResourceGroup();
+      //rg2.Name = groupName2;
+      //rg2.Id = groupID2;
+
+      //IList<Guid> rgList = new List<Guid>();
+      //rgList.Add(rg1.Id);
+      //rg2.ResourceGroup = rgList;
+
+      //rg2.Description = "descrrg2";
+      //dc.GetTable<DA.Resource>().InsertOnSubmit(HL.Convert.ToEntity(rg2));
+
+      //rg3 = new DT.ResourceGroup();
+      //rg3.Name = groupName3;
+      //rg3.Id = groupID3;
+      //rg3.Description = "descrrg3";
+      //dc.GetTable<DA.Resource>().InsertOnSubmit(HL.Convert.ToEntity(rg3));
+
+      //// create clients
+      //cl1 = new DT.Client();
+      //cl1.Name = clientName1;
+      //cl1.Id = clientID1;
+
+      //IList<Guid> rgList1 = new List<Guid>();
+      //rgList.Add(groupID1);
+      //cl1.ResourceGroup = rgList1;
+
+      //cl1.Description = "Test-PC-1";
+      //cl1.IPAdress = "192.168.0.10";
+      //cl1.NumberOfProcessors = "2";
+      //cl1.NumberOfThreads = "4";
+      //cl1.OperatingSystem = "WINXP";
+      //cl1.MemorySize = "2048";
+      //cl1.ProcessorType = "AMD";
+      //dc.GetTable<DA.Resource>().InsertOnSubmit(HL.Convert.ToEntity(cl1));
+
+      //cl2 = new DT.Client();
+      //cl2.Name = clientName2;
+      //cl2.Id = clientID2;
+
+      //IList<Guid> rgList2 = new List<Guid>();
+      //rgList.Add(groupID2);
+      //cl2.ResourceGroup = rgList2;
+
+      //cl2.Description = "Test-PC-2";
+      //cl2.IPAdress = "192.168.0.20";
+      //cl2.NumberOfProcessors = "4";
+      //cl2.NumberOfThreads = "4";
+      //cl2.OperatingSystem = "Vista";
+      //cl2.MemorySize = "4096";
+      //cl2.ProcessorType = "Intel";
+      //dc.GetTable<DA.Resource>().InsertOnSubmit(HL.Convert.ToEntity(cl2));
+
+      //// ResourceResourceGroups
+      //rrg1 = new DA.ResourceResourceGroup();
+      //rrg1.ResourceId = cl1.Id;
+      //rrg1.ResourceGroupId = rg1.Id;
+      //dc.GetTable<DA.ResourceResourceGroup>().InsertOnSubmit(rrg1);
+
+      //rrg2 = new DA.ResourceResourceGroup();
+      //rrg2.ResourceId = cl2.Id;
+      //rrg2.ResourceGroupId = rg2.Id;
+      //dc.GetTable<DA.ResourceResourceGroup>().InsertOnSubmit(rrg2);
+
+      //rrg3 = new DA.ResourceResourceGroup();
+      //rrg3.ResourceId = rg1.Id;
+      //rrg3.ResourceGroupId = rg3.Id;
+      //dc.GetTable<DA.ResourceResourceGroup>().InsertOnSubmit(rrg3);
+
+      //dc.SubmitChanges();
+
+
+     // AuthenticationService cs = new AuthenticationService();
+
+     // DA.Client client = dc.Resources.OfType<DA.Client>().First(x => x.Id == cl1.Id);
+     // DT.Client modClient = HeuristicLab.Services.Authentication.Convert.ToDto(client);
+
+     // //cl1.Id ;
+     // //cl1.ResourceType ;
+     // modClient.Name = "clientName1_modified";
+
+     //// IList<Guid> rgList = new List<Guid>();
+     //// rgList.Add(groupID3);
+
+     // //cl1.ResourceGroup = rgList;
+
+     // modClient.Description = "Test-PC-1_modifiet";
+     // modClient.IPAdress = "192.168.0.11";
+     // modClient.NumberOfProcessors = "4";
+     // modClient.NumberOfThreads = "2";
+     // modClient.OperatingSystem = "Vista";
+     // modClient.MemorySize = "2196";
+     // modClient.ProcessorType = "Intel";
+
+     // cs.UpdateClient(modClient);
+
     }
+  }
 }
Index: branches/ClientManagement/HeuristicLab.Services.Authentication/TestWebService/TestWebService.csproj
===================================================================
--- branches/ClientManagement/HeuristicLab.Services.Authentication/TestWebService/TestWebService.csproj	(revision 5004)
+++ branches/ClientManagement/HeuristicLab.Services.Authentication/TestWebService/TestWebService.csproj	(revision 5335)
@@ -39,4 +39,6 @@
       <RequiredTargetFramework>3.5</RequiredTargetFramework>
     </Reference>
+    <Reference Include="System.Data" />
+    <Reference Include="System.Data.Linq" />
   </ItemGroup>
   <ItemGroup>
@@ -50,4 +52,12 @@
   </ItemGroup>
   <ItemGroup>
+    <ProjectReference Include="..\HeuristicLab.Services.Authentication.DataAccess\HeuristicLab.Services.Authentication.DataAccess.csproj">
+      <Project>{AC7C2117-034E-4301-8A43-C869930D404E}</Project>
+      <Name>HeuristicLab.Services.Authentication.DataAccess</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\HeuristicLab.Services.Authentication.DataTransfer\HeuristicLab.Services.Authentication.DataTransfer.csproj">
+      <Project>{73E5113E-A293-4384-8B16-3CE38F2CFDC9}</Project>
+      <Name>HeuristicLab.Services.Authentication.DataTransfer</Name>
+    </ProjectReference>
     <ProjectReference Include="..\HeuristicLab.Services.Authentication\HeuristicLab.Services.Authentication.csproj">
       <Project>{ED8DC6E8-57C6-49E0-8CDF-25703AC52350}</Project>
Index: branches/ClientManagement/HeuristicLab.Services.Authentication/TestWebService/TestWebServiec.cs
===================================================================
--- branches/ClientManagement/HeuristicLab.Services.Authentication/TestWebService/TestWebServiec.cs	(revision 5004)
+++ branches/ClientManagement/HeuristicLab.Services.Authentication/TestWebService/TestWebServiec.cs	(revision 5335)
@@ -68,9 +68,22 @@
     }
 
+    class ResourceEqualityComparer : IEqualityComparer<DT.Resource> {
+      public bool Equals(DT.Resource rg1, DT.Resource rg2) {
+        return (
+          rg1.Name == rg2.Name &&
+          rg1.Id == rg2.Id
+        );
+      }
+
+      public int GetHashCode(DT.Resource obj) {
+        throw new NotImplementedException();
+      }
+    }
+
     private bool CompareClients(DT.Client c1, DT.Client c2) {
       return (
         c1.Name == c2.Name &&
         c1.Id == c2.Id &&
-        //c1.ResourceType == c2.ResourceType &&
+        c1.ResourceType == c2.ResourceType &&
         c1.Description == c2.Description &&
         c1.IPAdress == c2.IPAdress &&
@@ -91,4 +104,11 @@
     }
 
+    private bool CompareResources(DT.Resource r1, DT.Resource r2) {
+      return (
+        r1.Name == r2.Name &&
+        r1.Id == r2.Id
+        );
+    }
+
     private static int GetNumberOfEntries(string sqlCommand) {
       DA.ClientManagmentDataContext dc = new DA.ClientManagmentDataContext();
@@ -117,6 +137,8 @@
     public DA.ResourceResourceGroup rrg2 = null;
     public DA.ResourceResourceGroup rrg3 = null;
+    public DA.ResourceResourceGroup rrg4 = null;
+    public DA.ResourceResourceGroup rrg5 = null;
     #endregion
-    
+
     #region Additional test attributes
     //
@@ -142,5 +164,5 @@
 
     [TestInitialize()]
-    public void Init() {  
+    public void Init() {
 
       dc = new DA.ClientManagmentDataContext();
@@ -156,9 +178,9 @@
       }
 
-      
+
       // create groups
       rg1 = new DT.ResourceGroup();
       rg1.Name = groupName1;
-      rg1.Id = groupID1;      
+      rg1.Id = groupID1;
       rg1.Description = "descr rg1";
       dc.GetTable<DA.Resource>().InsertOnSubmit(HL.Convert.ToEntity(rg1));
@@ -167,5 +189,9 @@
       rg2.Name = groupName2;
       rg2.Id = groupID2;
-      rg2.ResourceGroup = rg1.Id;
+
+      IList<Guid> rgList = new List<Guid>();
+      rgList.Add(rg1.Id);
+      rg2.ResourceGroup = rgList;
+
       rg2.Description = "descrrg2";
       dc.GetTable<DA.Resource>().InsertOnSubmit(HL.Convert.ToEntity(rg2));
@@ -181,5 +207,9 @@
       cl1.Name = clientName1;
       cl1.Id = clientID1;
-      cl1.ResourceGroup = groupID1;
+
+      IList<Guid> rgList1 = new List<Guid>();
+      rgList.Add(groupID1);
+      cl1.ResourceGroup = rgList1;
+
       cl1.Description = "Test-PC-1";
       cl1.IPAdress = "192.168.0.10";
@@ -194,5 +224,9 @@
       cl2.Name = clientName2;
       cl2.Id = clientID2;
-      cl2.ResourceGroup = groupID2;
+
+      IList<Guid> rgList2 = new List<Guid>();
+      rgList.Add(groupID2);
+      cl2.ResourceGroup = rgList2;
+
       cl2.Description = "Test-PC-2";
       cl2.IPAdress = "192.168.0.20";
@@ -210,4 +244,10 @@
       dc.GetTable<DA.ResourceResourceGroup>().InsertOnSubmit(rrg1);
 
+      // ResourceResourceGroups
+      rrg5 = new DA.ResourceResourceGroup();
+      rrg5.ResourceId = cl1.Id;
+      rrg5.ResourceGroupId = rg2.Id;
+      dc.GetTable<DA.ResourceResourceGroup>().InsertOnSubmit(rrg5);
+
       DA.ResourceResourceGroup rrg2 = new DA.ResourceResourceGroup();
       rrg2.ResourceId = cl2.Id;
@@ -215,8 +255,13 @@
       dc.GetTable<DA.ResourceResourceGroup>().InsertOnSubmit(rrg2);
 
-      DA.ResourceResourceGroup rrg3 = new DA.ResourceResourceGroup();
-      rrg3.ResourceId = rg1.Id;
-      rrg3.ResourceGroupId = rg3.Id;
-      dc.GetTable<DA.ResourceResourceGroup>().InsertOnSubmit(rrg3);
+      //DA.ResourceResourceGroup rrg3 = new DA.ResourceResourceGroup();
+      //rrg3.ResourceId = rg3.Id;
+      //rrg3.ResourceGroupId = rg1.Id;
+      //dc.GetTable<DA.ResourceResourceGroup>().InsertOnSubmit(rrg3);
+
+      rrg4 = new DA.ResourceResourceGroup();
+      rrg4.ResourceId = rg2.Id;
+      rrg4.ResourceGroupId = rg1.Id;
+      dc.GetTable<DA.ResourceResourceGroup>().InsertOnSubmit(rrg4);
 
       dc.SubmitChanges();
@@ -225,18 +270,18 @@
     [TestCleanup()]
     public void CleanUp() {
-      dc = new DA.ClientManagmentDataContext();
-      if (dc.DatabaseExists()) {
-        //dc.DeleteDatabase();
-        dc.ExecuteCommand("delete from ResourceResourceGroup");
-        dc.ExecuteCommand("delete from Resource");
-        dc.SubmitChanges();
-      }
-      else {
-        dc.CreateDatabase();
-        dc.SubmitChanges();
-      }
-    }
-
-    #region TestMethods    
+      //dc = new DA.ClientManagmentDataContext();
+      //if (dc.DatabaseExists()) {
+      //  //dc.DeleteDatabase();
+      //  dc.ExecuteCommand("delete from ResourceResourceGroup");
+      //  dc.ExecuteCommand("delete from Resource");
+      //  dc.SubmitChanges();
+      //}
+      //else {
+      //  dc.CreateDatabase();
+      //  dc.SubmitChanges();
+      //}
+    }
+
+    #region TestMethods
 
     #region TestGroup
@@ -247,5 +292,5 @@
     [TestMethod]
     public void TestAddResourceGroup() {
-      ClientService cs = new ClientService();
+      AuthenticationService cs = new AuthenticationService();
 
       DT.ResourceGroup rg4 = new DT.ResourceGroup();
@@ -265,8 +310,22 @@
 
     /// <summary>
-    /// TODO
+
     /// </summary>
     [TestMethod]
     public void TestUpdateResourceGroup() {
+      AuthenticationService cs = new AuthenticationService();
+
+      DA.ResourceGroup group = dc.Resources.OfType<DA.ResourceGroup>().First(x => x.Id == rg1.Id);
+      DT.ResourceGroup modGroup = HeuristicLab.Services.Authentication.Convert.ToDto(group);
+
+
+      modGroup.Name = "clientName1_modified";
+
+      IList<Guid> rgList = new List<Guid>();
+      rgList.Add(groupID3);
+      modGroup.ResourceGroup = rgList;
+      modGroup.Description = "Test-group_modifiet";
+
+      cs.UpdateResourceGroup(modGroup);
     }
 
@@ -276,5 +335,5 @@
     [TestMethod]
     public void TestGetResourceGroup() {
-      ClientService cs = new ClientService();
+      AuthenticationService cs = new AuthenticationService();
       DT.ResourceGroup rg = cs.GetResourceGroup(groupID1);
       Assert.AreEqual(rg.Id, groupID1);
@@ -287,5 +346,5 @@
     [TestMethod]
     public void TestGetResourceGroups() {
-      ClientService cs = new ClientService();
+      AuthenticationService cs = new AuthenticationService();
       IEnumerable<DT.ResourceGroup> groups = cs.GetResourceGroups();
       Assert.AreEqual(3, groups.Count<DT.ResourceGroup>());
@@ -298,12 +357,12 @@
 
     /// <summary>
-    /// Delete existing ResourceGroup whisch is no parent group
+    /// Delete existing ResourceGroup which is no parent group
     /// </summary>
     [TestMethod]
     public void TestDeleteResourceGroup1() {
-      ClientService cs = new ClientService();
+      AuthenticationService cs = new AuthenticationService();
 
       int cntPrev = GetNumberOfEntries(sqlCountGroups);
-      Assert.IsTrue(cs.DeleteResourceGroup(rg2));
+      cs.DeleteResourceGroup(rg2);
       int cntNew = GetNumberOfEntries(sqlCountGroups);
       Assert.AreEqual(cntPrev, (cntNew + 1));
@@ -311,12 +370,11 @@
 
     /// <summary>
-    /// try to delete existing ResourceGroup whisch is parent group
+    /// try to delete existing ResourceGroup wich is parent group
     /// </summary>
     [TestMethod]
     public void TestDeleteResourceGroup2() {
-      ClientService cs = new ClientService();
-
+      AuthenticationService cs = new AuthenticationService();
       int cntPrev = GetNumberOfEntries(sqlCountGroups);
-      Assert.IsFalse(cs.DeleteResourceGroup(rg1));
+      cs.DeleteResourceGroup(rg1);
       int cntNew = GetNumberOfEntries(sqlCountGroups);
       Assert.AreEqual(cntPrev, cntNew);
@@ -332,9 +390,13 @@
     [TestMethod]
     public void TestAddClient1() {
-      ClientService cs = new ClientService();
+      AuthenticationService cs = new AuthenticationService();
 
       DT.Client cl3 = new DT.Client();
       cl3.Name = "clientName3";
-      cl3.ResourceGroup = groupID3;
+
+      IList<Guid> rgList = new List<Guid>();
+      rgList.Add(groupID3);
+      cl3.ResourceGroup = rgList;
+
       cl3.Description = "Test-PC-3";
       cl3.IPAdress = "192.168.0.30";
@@ -347,5 +409,5 @@
       int cntPrev = GetNumberOfEntries(sqlCountClients);
       cl3.Id = cs.AddClient(cl3);
-      Assert.AreNotEqual(Guid.Empty, cl3.Id); 
+      Assert.AreNotEqual(Guid.Empty, cl3.Id);
       int cntNew = GetNumberOfEntries(sqlCountClients);
       Assert.AreEqual(cntPrev, (cntNew - 1));
@@ -360,9 +422,12 @@
     [TestMethod]
     public void TestAddClient2() {
-      ClientService cs = new ClientService();
+      AuthenticationService cs = new AuthenticationService();
 
       DT.Client cl3 = new DT.Client();
       cl3.Name = "clientNamexxxx";
-      cl3.ResourceGroup = Guid.NewGuid();
+
+      IList<Guid> rgList = new List<Guid>();
+      rgList.Add(Guid.NewGuid());
+      cl3.ResourceGroup = rgList;
 
       int cntPrev = GetNumberOfEntries(sqlCountClients);
@@ -370,5 +435,5 @@
       Assert.AreEqual(Guid.Empty, cl3.Id);
       int cntNew = GetNumberOfEntries(sqlCountClients);
-      Assert.AreEqual(cntPrev, cntNew); 
+      Assert.AreEqual(cntPrev, cntNew);
     }
 
@@ -378,5 +443,5 @@
     [TestMethod]
     public void TestGetClient1() {
-      ClientService cs = new ClientService();
+      AuthenticationService cs = new AuthenticationService();
       DT.Client cl = cs.GetClient(clientID1);
       Assert.AreEqual(cl.Id, clientID1);
@@ -392,5 +457,5 @@
     //[TestMethod]
     //public void TestGetClient2() {
-    //  ClientService cs = new ClientService();
+    //  AuthenticationService cs = new AuthenticationService();
     //  DT.Client cl = cs.GetClient(Guid.NewGuid());
     //  Assert.IsNull(cl);
@@ -402,5 +467,5 @@
     //[TestMethod]
     //public void TestGetClient3() {
-    //  ClientService cs = new ClientService();
+    //  AuthenticationService cs = new AuthenticationService();
     //  DT.Client cl = cs.GetClient(Guid.Empty);
     //  Assert.IsNull(cl);
@@ -416,34 +481,38 @@
     [TestMethod]
     public void TestDeleteClient1() {
-      ClientService cs = new ClientService();
+      AuthenticationService cs = new AuthenticationService();
 
       int cntPrev = GetNumberOfEntries(sqlCountClients);
-      Assert.IsTrue(cs.DeleteClient(cl1));
+      cs.DeleteClient(cl1);
       int cntNew = GetNumberOfEntries(sqlCountClients);
       Assert.AreEqual(cntPrev, (cntNew + 1));
     }
 
-    /// <summary>
-    /// try to delete not existing client
-    /// </summary>
-    [TestMethod]
-    public void TestDeleteClient2() {
-      ClientService cs = new ClientService();
-      DT.Client cl3 = new DT.Client();
-      cl3.Name = "clientName3";
-      cl3.ResourceGroup = groupID3;
-      cl3.Description = "Test-PC-3";
-      cl3.IPAdress = "192.168.0.30";
-      cl3.NumberOfProcessors = "2";
-      cl3.NumberOfThreads = "2";
-      cl3.OperatingSystem = "Vista";
-      cl3.MemorySize = "4096";
-      cl3.ProcessorType = "Intel";
-
-      int cntPrev = GetNumberOfEntries(sqlCountClients);
-      Assert.IsFalse(cs.DeleteClient(cl3));
-      int cntNew = GetNumberOfEntries(sqlCountClients);
-      Assert.AreEqual(cntPrev, cntNew);
-    }
+    ///// <summary>
+    ///// try to delete not existing client
+    ///// </summary>
+    //[TestMethod]
+    //public void TestDeleteClient2() {
+    //  AuthenticationService cs = new AuthenticationService();
+    //  DT.Client cl3 = new DT.Client();
+    //  cl3.Name = "clientName3";
+
+    //  IList<Guid> rgList = new List<Guid>();
+    //  rgList.Add(groupID3);
+    //  cl3.ResourceGroup = rgList;
+
+    //  cl3.Description = "Test-PC-3";
+    //  cl3.IPAdress = "192.168.0.30";
+    //  cl3.NumberOfProcessors = "2";
+    //  cl3.NumberOfThreads = "2";
+    //  cl3.OperatingSystem = "Vista";
+    //  cl3.MemorySize = "4096";
+    //  cl3.ProcessorType = "Intel";
+
+    //  int cntPrev = GetNumberOfEntries(sqlCountClients);
+    //  cs.DeleteClient(cl3);
+    //  int cntNew = GetNumberOfEntries(sqlCountClients);
+    //  Assert.AreEqual(cntPrev, cntNew);
+    //}
 
     /// <summary>
@@ -452,5 +521,5 @@
     [TestMethod]
     public void TestGetClients() {
-      ClientService cs = new ClientService();
+      AuthenticationService cs = new AuthenticationService();
       IEnumerable<DT.Client> clients = cs.GetClients();
       Assert.AreEqual(2, clients.Count<DT.Client>());
@@ -466,54 +535,94 @@
     [TestMethod]
     public void TestUpdateClient1() {
-      ClientService cs = new ClientService();
-      DT.Client cl1 = new DT.Client();
-      cl1.Name = "clientName1_modified";
-      cl1.ResourceGroup = groupID3;
-      cl1.Description = "Test-PC-1_modifiet";
-      cl1.IPAdress = "192.168.0.11";
-      cl1.NumberOfProcessors = "4";
-      cl1.NumberOfThreads = "2";
-      cl1.OperatingSystem = "Vista";
-      cl1.MemorySize = "2096";
-      cl1.ProcessorType = "Intel";
-
-      int cntPrev = GetNumberOfEntries(sqlCountClients);
-      Assert.IsTrue(cs.UpdateClient(cl1));
-      int cntNew = GetNumberOfEntries(sqlCountClients);
-      Assert.AreEqual(cntPrev, cntNew);
+      AuthenticationService cs = new AuthenticationService();
 
       DA.Client client = dc.Resources.OfType<DA.Client>().First(x => x.Id == cl1.Id);
-      Assert.IsTrue(CompareClients(HL.Convert.ToDto(client), cl1));
-    }
-
-    /// <summary>
-    /// try to update not existing client
-    /// </summary>
-    [TestMethod]
-    public void TestUpdateClient2() {
-      ClientService cs = new ClientService();
-      DT.Client cl3 = new DT.Client();
-      cl3.Id = Guid.NewGuid();
-      cl3.Name = "clientName3";
-      cl3.ResourceGroup = groupID3;
-      cl3.Description = "Test-PC-3";
-      cl3.IPAdress = "192.168.0.30";
-      cl3.NumberOfProcessors = "2";
-      cl3.NumberOfThreads = "2";
-      cl3.OperatingSystem = "Vista";
-      cl3.MemorySize = "4096";
-      cl3.ProcessorType = "Intel";
-
-      int cntPrev = GetNumberOfEntries(sqlCountClients);
-      Assert.IsFalse(cs.UpdateClient(cl3));
-      int cntNew = GetNumberOfEntries(sqlCountClients);
-      Assert.AreEqual(cntPrev, cntNew);
-
-      DA.Client client = dc.Resources.OfType<DA.Client>().First(x => x.Id == cl3.Id);
-      Assert.IsNull(client);
-    }
+      DT.Client modClient = HeuristicLab.Services.Authentication.Convert.ToDto(client);
+
+      //cl1.Id ;
+      //cl1.ResourceType ;
+      modClient.Name = "clientName1_modified";
+
+      IList<Guid> rgList = new List<Guid>();
+      rgList.Add(groupID3);
+      modClient.ResourceGroup = rgList;
+
+      modClient.Description = "Test-PC-1_modifiet";
+      modClient.IPAdress = "192.168.0.11";
+      modClient.NumberOfProcessors = "4";
+      modClient.NumberOfThreads = "2";
+      modClient.OperatingSystem = "Vista";
+      modClient.MemorySize = "2196";
+      modClient.ProcessorType = "Intel";
+
+      cs.UpdateClient(modClient);
+
+      //DA.Client client1 = dc.Resources.OfType<DA.Client>().First(x => x.Id == cl1.Id);
+      //Assert.IsTrue(CompareClients(HL.Convert.ToDto(client1), modClient));
+    }
+
+    ///// <summary>
+    ///// try to update not existing client
+    ///// </summary>
+    //[TestMethod]
+    //public void TestUpdateClient2() {
+    //  AuthenticationService cs = new AuthenticationService();
+    //  DT.Client cl3 = new DT.Client();
+    //  cl3.Id = Guid.NewGuid();
+    //  cl3.Name = "clientName3";
+
+    //  IList<Guid> rgList = new List<Guid>();
+    //  rgList.Add(groupID3);
+    //  cl3.ResourceGroup = rgList;
+
+    //  cl3.Description = "Test-PC-3";
+    //  cl3.IPAdress = "192.168.0.30";
+    //  cl3.NumberOfProcessors = "2";
+    //  cl3.NumberOfThreads = "2";
+    //  cl3.OperatingSystem = "Vista";
+    //  cl3.MemorySize = "4096";
+    //  cl3.ProcessorType = "Intel";
+
+    //  int cntPrev = GetNumberOfEntries(sqlCountClients);
+    //  //Assert.IsFalse(cs.UpdateClient(cl3));
+    //  int cntNew = GetNumberOfEntries(sqlCountClients);
+    //  Assert.AreEqual(cntPrev, cntNew);
+
+    //  DA.Client client = dc.Resources.OfType<DA.Client>().First(x => x.Id == cl3.Id);
+    //  Assert.IsNull(client);
+    //}
 
     #endregion
-   
+
+    /// <summary>
+    /// get Members
+    /// </summary>
+    [TestMethod]
+    public void TestGetMembers() {
+      AuthenticationService cs = new AuthenticationService();
+      IEnumerable<DT.Resource> members = cs.GetMembers(rg1.Id);
+      Assert.AreEqual(2, members.Count());
+    }
+
+    /// <summary>
+    /// get ResourceGroupsOf
+    /// </summary>
+    [TestMethod]
+    public void TestGetResourceGroupsOf() {
+      AuthenticationService cs = new AuthenticationService();
+      IEnumerable<DT.Resource> resGroups = cs.GetResourceGroupsOf(cl1.Id);
+      Assert.AreEqual(2, resGroups.Count());
+    }
+
+    /// <summary>
+    /// get Members
+    /// </summary>
+    [TestMethod]
+    public void TestGetRootResources() {
+      AuthenticationService cs = new AuthenticationService();
+      IEnumerable<DT.Resource> rootResourceList = cs.GetRootResources();
+      Assert.AreEqual(2, rootResourceList.Count());
+    }
+
     #endregion //Testmethods
   }
