Index: branches/ClientManagement/HeuristicLab.Services.Authentication/HeuristicLab.Services.Authentication.DataAccess/ClientManagment.dbml
===================================================================
--- branches/ClientManagement/HeuristicLab.Services.Authentication/HeuristicLab.Services.Authentication.DataAccess/ClientManagment.dbml	(revision 4802)
+++ branches/ClientManagement/HeuristicLab.Services.Authentication/HeuristicLab.Services.Authentication.DataAccess/ClientManagment.dbml	(revision 4953)
@@ -1,7 +1,7 @@
-﻿<?xml version="1.0" encoding="utf-8"?><Database Class="ClientManagmentDataContext" xmlns="http://schemas.microsoft.com/linqtosql/dbml/2007">
-  <Connection Mode="AppSettings" ConnectionString="Data Source=.\SQLEXPRESS;Initial Catalog=HeuristicLab.ClientManagment;Integrated Security=True" SettingsObjectName="HeuristicLab.Services.Authentication.DataAccess.Properties.Settings" SettingsPropertyName="ClientManagementConnectionString" Provider="System.Data.SqlClient" />
+﻿<?xml version="1.0" encoding="utf-8"?><Database Name="HeuristicLab.ClientManagment" Class="ClientManagmentDataContext" xmlns="http://schemas.microsoft.com/linqtosql/dbml/2007">
+  <Connection Mode="AppSettings" ConnectionString="Data Source=.\SQL2008;Initial Catalog=HeuristicLab.ClientManagment;Integrated Security=True" SettingsObjectName="HeuristicLab.Services.Authentication.DataAccess.Properties.Settings" SettingsPropertyName="ClientManagementConnectionString" Provider="System.Data.SqlClient" />
   <Table Name="" Member="Resources">
     <Type Name="Resource" InheritanceCode="Resource">
-      <Column Name="ResourceID" Member="Id" Storage="_ResourceID" AutoSync="OnInsert" Type="System.Guid" IsPrimaryKey="true" CanBeNull="false" />
+      <Column Name="Id" Storage="_ResourceID" AutoSync="OnInsert" Type="System.Guid" IsPrimaryKey="true" CanBeNull="false" />
       <Column Name="Name" Type="System.String" CanBeNull="false" />
       <Column Name="Description" Type="System.String" CanBeNull="true" />
@@ -22,6 +22,6 @@
   <Table Name="" Member="ResourceResourceGroups">
     <Type Name="ResourceResourceGroup">
-      <Column Name="ResourceID" Member="ResourceId" Storage="_ResourceID" Type="System.Guid" IsPrimaryKey="true" CanBeNull="false" />
-      <Column Name="ResourceGroupID" Member="ResourceGroupId" Storage="_ResourceGroupID" Type="System.Guid" IsPrimaryKey="true" CanBeNull="false" />
+      <Column Name="ResourceId" Storage="_ResourceID" Type="System.Guid" IsPrimaryKey="true" CanBeNull="false" />
+      <Column Name="ResourceGroupId" Storage="_ResourceGroupID" Type="System.Guid" IsPrimaryKey="true" CanBeNull="false" />
       <Association Name="Resource_ResourceResourceGroup" Member="Client" Storage="_Resource" ThisKey="ResourceId" OtherKey="Id" Type="Resource" IsForeignKey="true" />
       <Association Name="Resource_ResourceResourceGroup1" Member="ResourceGroup" Storage="_Resource1" ThisKey="ResourceGroupId" OtherKey="Id" Type="Resource" IsForeignKey="true" />
Index: branches/ClientManagement/HeuristicLab.Services.Authentication/HeuristicLab.Services.Authentication.DataAccess/ClientManagment.dbml.layout
===================================================================
--- branches/ClientManagement/HeuristicLab.Services.Authentication/HeuristicLab.Services.Authentication.DataAccess/ClientManagment.dbml.layout	(revision 4802)
+++ branches/ClientManagement/HeuristicLab.Services.Authentication/HeuristicLab.Services.Authentication.DataAccess/ClientManagment.dbml.layout	(revision 4953)
@@ -3,17 +3,17 @@
   <DataContextMoniker Name="/ClientManagmentDataContext" />
   <nestedChildShapes>
-    <classShape Id="cace4a80-c7a9-4132-9b82-c4ef3884dbc0" absoluteBounds="0.75, 3.875, 2, 1.7535424804687496">
+    <classShape Id="cace4a80-c7a9-4132-9b82-c4ef3884dbc0" absoluteBounds="0.75, 3.875, 2, 1.9631982421874996">
       <DataClassMoniker Name="/ClientManagmentDataContext/Client" />
       <nestedChildShapes>
-        <elementListCompartment Id="bce42ce5-f605-4c26-a210-ed4ea2812ca7" absoluteBounds="0.765, 4.335, 1.9700000000000002, 1.19354248046875" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
+        <elementListCompartment Id="bce42ce5-f605-4c26-a210-ed4ea2812ca7" absoluteBounds="0.765, 4.335, 1.9700000000000002, 1.4031982421875" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
       </nestedChildShapes>
     </classShape>
-    <classShape Id="ea129a98-d63f-4c3a-a3e8-dff64ad53c30" absoluteBounds="2.125, 1.25, 2, 1.424847819010417">
+    <classShape Id="ea129a98-d63f-4c3a-a3e8-dff64ad53c30" absoluteBounds="2, 1.125, 2, 1.5785953776041666">
       <DataClassMoniker Name="/ClientManagmentDataContext/Resource" />
       <nestedChildShapes>
-        <elementListCompartment Id="3a656a72-fe83-45a4-87c2-c0aa13fa068f" absoluteBounds="2.14, 1.71, 1.9700000000000002, 0.86484781901041663" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
+        <elementListCompartment Id="3a656a72-fe83-45a4-87c2-c0aa13fa068f" absoluteBounds="2.015, 1.585, 1.9700000000000002, 1.0185953776041665" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
       </nestedChildShapes>
     </classShape>
-    <inheritanceConnector edgePoints="[(3.125 : 2.67484781901042); (3.125 : 3.5); (1.75 : 3.5); (1.75 : 3.875)]" fixedFrom="NotFixed" fixedTo="NotFixed" TargetRelationshipDomainClassId="7a7fe09e-e9ef-4b01-9ff3-bde95e827b62">
+    <inheritanceConnector edgePoints="[(3 : 2.70359537760417); (3 : 3.5); (1.75 : 3.5); (1.75 : 3.875)]" fixedFrom="NotFixed" fixedTo="NotFixed" TargetRelationshipDomainClassId="7a7fe09e-e9ef-4b01-9ff3-bde95e827b62">
       <nodes>
         <classShapeMoniker Id="ea129a98-d63f-4c3a-a3e8-dff64ad53c30" />
@@ -21,11 +21,11 @@
       </nodes>
     </inheritanceConnector>
-    <classShape Id="7820d3d1-da69-4786-9415-4fa77e5fc03a" absoluteBounds="3.625, 3.875, 2, 0.76745849609374961">
+    <classShape Id="7820d3d1-da69-4786-9415-4fa77e5fc03a" absoluteBounds="3.625, 3.875, 2, 0.80938964843749961">
       <DataClassMoniker Name="/ClientManagmentDataContext/ResourceGroup" />
       <nestedChildShapes>
-        <elementListCompartment Id="125f9904-768c-4c01-9a04-5212a9e6e484" absoluteBounds="3.64, 4.335, 1.9700000000000002, 0.20745849609375" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
+        <elementListCompartment Id="125f9904-768c-4c01-9a04-5212a9e6e484" absoluteBounds="3.64, 4.335, 1.9700000000000002, 0.2493896484375" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
       </nestedChildShapes>
     </classShape>
-    <inheritanceConnector edgePoints="[(3.125 : 2.67484781901042); (3.125 : 3.5); (4.625 : 3.5); (4.625 : 3.875)]" fixedFrom="NotFixed" fixedTo="NotFixed" TargetRelationshipDomainClassId="7a7fe09e-e9ef-4b01-9ff3-bde95e827b62">
+    <inheritanceConnector edgePoints="[(3 : 2.70359537760417); (3 : 3.5); (4.625 : 3.5); (4.625 : 3.875)]" fixedFrom="NotFixed" fixedTo="NotFixed" TargetRelationshipDomainClassId="7a7fe09e-e9ef-4b01-9ff3-bde95e827b62">
       <nodes>
         <classShapeMoniker Id="ea129a98-d63f-4c3a-a3e8-dff64ad53c30" />
@@ -33,11 +33,11 @@
       </nodes>
     </inheritanceConnector>
-    <classShape Id="9b206f4e-128f-4c3f-bd08-7f2d271ebb2b" absoluteBounds="5.125, 1.25, 2, 1.0961531575520831">
+    <classShape Id="9b206f4e-128f-4c3f-bd08-7f2d271ebb2b" absoluteBounds="5.125, 1.25, 2, 1.1939925130208331">
       <DataClassMoniker Name="/ClientManagmentDataContext/ResourceResourceGroup" />
       <nestedChildShapes>
-        <elementListCompartment Id="9d879183-e5e2-42e9-9fbf-3e68f959d459" absoluteBounds="5.14, 1.71, 1.9700000000000002, 0.53615315755208326" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
+        <elementListCompartment Id="9d879183-e5e2-42e9-9fbf-3e68f959d459" absoluteBounds="5.14, 1.71, 1.9700000000000002, 0.63399251302083326" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
       </nestedChildShapes>
     </classShape>
-    <associationConnector edgePoints="[(4.125 : 2.01147048950195); (5.125 : 2.01147048950195)]" fixedFrom="NotFixed" fixedTo="NotFixed">
+    <associationConnector edgePoints="[(4 : 1.84699625651042); (5.125 : 1.84699625651042)]" fixedFrom="NotFixed" fixedTo="NotFixed">
       <AssociationMoniker Name="/ClientManagmentDataContext/Resource/Resource_ResourceResourceGroup" />
       <nodes>
@@ -46,5 +46,5 @@
       </nodes>
     </associationConnector>
-    <associationConnector edgePoints="[(4.125 : 1.56823524475098); (5.125 : 1.56823524475098)]" fixedFrom="NotFixed" fixedTo="NotFixed">
+    <associationConnector edgePoints="[(4 : 2.10706709867143); (5.125 : 2.10706709867143)]" fixedFrom="NotFixed" fixedTo="NotFixed">
       <AssociationMoniker Name="/ClientManagmentDataContext/Resource/Resource_ResourceResourceGroup1" />
       <nodes>
Index: branches/ClientManagement/HeuristicLab.Services.Authentication/HeuristicLab.Services.Authentication.DataAccess/ClientManagment.designer.cs
===================================================================
--- branches/ClientManagement/HeuristicLab.Services.Authentication/HeuristicLab.Services.Authentication.DataAccess/ClientManagment.designer.cs	(revision 4802)
+++ branches/ClientManagement/HeuristicLab.Services.Authentication/HeuristicLab.Services.Authentication.DataAccess/ClientManagment.designer.cs	(revision 4953)
@@ -23,4 +23,5 @@
 	
 	
+	[global::System.Data.Linq.Mapping.DatabaseAttribute(Name="HeuristicLab.ClientManagment")]
 	public partial class ClientManagmentDataContext : System.Data.Linq.DataContext
 	{
@@ -127,5 +128,5 @@
 		}
 		
-		[global::System.Data.Linq.Mapping.ColumnAttribute(Name="ResourceID", Storage="_ResourceID", AutoSync=AutoSync.OnInsert, IsPrimaryKey=true)]
+		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ResourceID", AutoSync=AutoSync.OnInsert, IsPrimaryKey=true)]
 		public System.Guid Id
 		{
@@ -483,5 +484,5 @@
 		}
 		
-		[global::System.Data.Linq.Mapping.ColumnAttribute(Name="ResourceID", Storage="_ResourceID", IsPrimaryKey=true)]
+		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ResourceID", IsPrimaryKey=true)]
 		public System.Guid ResourceId
 		{
@@ -494,4 +495,8 @@
 				if ((this._ResourceID != value))
 				{
+					if (this._Resource.HasLoadedOrAssignedValue)
+					{
+						throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
+					}
 					this.OnResourceIdChanging(value);
 					this.SendPropertyChanging();
@@ -503,5 +508,5 @@
 		}
 		
-		[global::System.Data.Linq.Mapping.ColumnAttribute(Name="ResourceGroupID", Storage="_ResourceGroupID", IsPrimaryKey=true)]
+		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ResourceGroupID", IsPrimaryKey=true)]
 		public System.Guid ResourceGroupId
 		{
@@ -514,4 +519,8 @@
 				if ((this._ResourceGroupID != value))
 				{
+					if (this._Resource1.HasLoadedOrAssignedValue)
+					{
+						throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
+					}
 					this.OnResourceGroupIdChanging(value);
 					this.SendPropertyChanging();
Index: branches/ClientManagement/HeuristicLab.Services.Authentication/HeuristicLab.Services.Authentication.DataTransfer/Resource.cs
===================================================================
--- branches/ClientManagement/HeuristicLab.Services.Authentication/HeuristicLab.Services.Authentication.DataTransfer/Resource.cs	(revision 4802)
+++ branches/ClientManagement/HeuristicLab.Services.Authentication/HeuristicLab.Services.Authentication.DataTransfer/Resource.cs	(revision 4953)
@@ -7,5 +7,5 @@
     {
         [DataMember]
-        public System.Guid ResourceID { get; set; }
+        public System.Guid Id { get; set; }
         [DataMember]
         public string Name { get; set; }
@@ -15,5 +15,5 @@
         public string ResourceType { get; set; }
         [DataMember]
-        public string ResourceGroup { get; set; }
+        public System.Guid ResourceGroup { get; set; }
     }
 }
Index: branches/ClientManagement/HeuristicLab.Services.Authentication/HeuristicLab.Services.Authentication/ClientService.cs
===================================================================
--- branches/ClientManagement/HeuristicLab.Services.Authentication/HeuristicLab.Services.Authentication/ClientService.cs	(revision 4802)
+++ branches/ClientManagement/HeuristicLab.Services.Authentication/HeuristicLab.Services.Authentication/ClientService.cs	(revision 4953)
@@ -1,85 +1,186 @@
 ﻿using System;
 using System.Collections.Generic;
-using System.Collections;
 using System.Linq;
-using System.Data.Linq;
-using System.Data.Linq.Mapping;
-using System.Text;
-
 using HeuristicLab.Services.Authentication.DataAccess;
-using HeuristicLab.Services.Authentication.DataTransfer;
-using HeuristicLab.Services.Authentication;
 using DA = HeuristicLab.Services.Authentication.DataAccess;
 using DT = HeuristicLab.Services.Authentication.DataTransfer;
-using HLSA = HeuristicLab.Services.Authentication;
 
 
-namespace HeuristicLab.Services.Authentication {
+namespace HeuristicLab.Services.Authentication
+{
 
-  public class ClientService : IClientService{
+    public class ClientService : IClientService
+    {
+
+        public DataTransfer.Client GetClient(Guid id)
+        {
+            using (ClientManagmentDataContext cmdc = new ClientManagmentDataContext())
+            {
+                DA.Client client = cmdc.Resources.OfType<DA.Client>().First(x => x.Id == id);
+                return Convert.ToDto(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 (allClients.Count > 0)
+                    return allClients;
+                return null;
+            }
+        }
+
+        public Guid AddClient(DataTransfer.Client dto)
+        {
+            using (ClientManagmentDataContext cmdc = new ClientManagmentDataContext())
+            {
+                return InsertResource(cmdc, dto);
+            }
+        }
 
 
-    private void RemoveRRGEntry(ClientManagmentDataContext cmdc, Guid resID) {
-      foreach (var rrg in cmdc.ResourceResourceGroups.Where(x => x.ResourceId == resID))
-        cmdc.ResourceResourceGroups.DeleteOnSubmit(rrg);
+        public bool UpdateClient(DataTransfer.Client dto)
+        {
+            throw new NotImplementedException();
+        }
+
+        public bool DeleteClient(DataTransfer.Client dto)
+        {
+            using (ClientManagmentDataContext cmdc = new ClientManagmentDataContext())
+            {
+                return RemoveResource(cmdc, dto);
+            }
+        }
+
+        public DataTransfer.ResourceGroup GetResourceGroup(Guid id)
+        {
+            using (ClientManagmentDataContext cmdc = new ClientManagmentDataContext())
+            {
+                DA.ResourceGroup client = cmdc.Resources.OfType<DA.ResourceGroup>().First(x => x.Id == id);
+                return Convert.ToDto(client);
+            }
+        }
+
+        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 bool UpdateResourceGroup(DataTransfer.ResourceGroup dto)
+        {
+            throw new NotImplementedException();
+        }
+
+        public bool DeleteResourceGroup(DataTransfer.ResourceGroup dto)
+        {
+            using (ClientManagmentDataContext cmdc = new ClientManagmentDataContext())
+            {
+                return RemoveResource(cmdc, dto);
+            }
+        }
+
+        public IEnumerable<DataTransfer.Resource> GetMembers(Guid id)
+        {
+            throw new NotImplementedException();
+        }
+
+        public IEnumerable<DataTransfer.Resource> GetRootResources()
+        {
+            throw new NotImplementedException();
+        }
+
+        private IEnumerable<DataTransfer.Resource> GetMembers(ClientManagmentDataContext cmdc, Guid id)
+        {
+            // TODO IMPLEMENTATION
+            return null;
+        }
+
+        private Guid InsertResource(ClientManagmentDataContext cmdc, DT.Resource dto)
+        {
+            ResourceResourceGroup rrg = null;
+            if (dto.ResourceGroup != Guid.Empty)
+            {
+                ResourceGroup grp = cmdc.Resources.OfType<DA.ResourceGroup>().FirstOrDefault(x => x.Id == dto.ResourceGroup);
+                if (grp == null)
+                    return Guid.Empty;
+                rrg = new ResourceResourceGroup();
+                rrg.ResourceGroup = grp;
+            }
+            DA.Resource entity = Convert.ToEntity(dto);
+            if (entity != null)
+            {
+                entity.Id = Guid.NewGuid();
+                if (rrg != null)
+                    rrg.Client = entity;
+                cmdc.Resources.InsertOnSubmit(entity);
+                if (rrg != null)
+                    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);
+            }
+        }
     }
-
-
-    public DataTransfer.Client GetClient(Guid id) {
-      throw new NotImplementedException();
-    }
-
-    public IEnumerable<DataTransfer.Client> GetClients() {
-      throw new NotImplementedException();
-    }
-
-    public Guid AddClient(DataTransfer.Client dto) {
-      throw new NotImplementedException();
-    }
-
-    public bool UpdateClient(DataTransfer.Client dto) {
-      throw new NotImplementedException();
-    }
-
-    public bool DeleteClient(DataTransfer.Client dto) {
-      using (ClientManagmentDataContext cmdc = new ClientManagmentDataContext()) {
-        RemoveRRGEntry(cmdc, dto.ResourceID);
-        DA.Resource entity = cmdc.Resources.FirstOrDefault(x => x.Id == dto.ResourceID);
-        if (entity != null) {
-          cmdc.Resources.DeleteOnSubmit(entity);
-          cmdc.SubmitChanges();
-          return true;
-        }
-        return false;
-      }
-    }
-
-    public DataTransfer.ResourceGroup GetResourceGroup(Guid id) {
-      throw new NotImplementedException();
-    }
-
-    public IEnumerable<DataTransfer.ResourceGroup> GetResourceGroups() {
-      throw new NotImplementedException();
-    }
-
-    public Guid AddResourceGroup(DataTransfer.ResourceGroup dto) {
-      throw new NotImplementedException();
-    }
-
-    public bool UpdateResourceGroup(DataTransfer.ResourceGroup dto) {
-      throw new NotImplementedException();
-    }
-
-    public bool DeleteResourceGroup(DataTransfer.ResourceGroup id) {
-      throw new NotImplementedException();
-    }
-
-    public IEnumerable<DataTransfer.Resource> GetMembers(Guid id) {
-      throw new NotImplementedException();
-    }
-
-    public IEnumerable<DataTransfer.Resource> GetRootResources() {
-      throw new NotImplementedException();
-    }
-  }
 }
Index: branches/ClientManagement/HeuristicLab.Services.Authentication/HeuristicLab.Services.Authentication/Convert.cs
===================================================================
--- branches/ClientManagement/HeuristicLab.Services.Authentication/HeuristicLab.Services.Authentication/Convert.cs	(revision 4802)
+++ branches/ClientManagement/HeuristicLab.Services.Authentication/HeuristicLab.Services.Authentication/Convert.cs	(revision 4953)
@@ -21,90 +21,120 @@
 
 using System.Data.Linq;
+using HeuristicLab.Services.Authentication.DataTransfer;
 using DA = HeuristicLab.Services.Authentication.DataAccess;
 using DT = HeuristicLab.Services.Authentication.DataTransfer;
 
-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 { 
-        ResourceID = 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 = 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.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
+
+        #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,
+            };
+        }
+
+        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 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 DA.Client ToEntity(DT.Client source) {
-      if (source == null) return null;
-      return new DA.Client { 
-        Id = source.ResourceID, 
-        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 void ToEntity(DT.Client source, DA.Client target) {
-      if ((source != null) && (target != null)) {
-        target.Id = source.ResourceID; 
-        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
-
-
-    #region ResourceGroup
-    public static DT.ResourceGroup ToDto(DA.ResourceGroup source) {
-      if (source == null) return null;
-      return new DT.ResourceGroup {
-        ResourceID = 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.ResourceID,
-        Name = source.Name,
-        Description = source.Description,
-        ResourceType = source.ResourceType,
-      };
-    }
-
-    public static void ToEntity(DT.ResourceGroup source, DA.ResourceGroup target) {
-      if ((source != null) && (target != null)) {
-        target.Id = source.ResourceID;
-        target.Name = source.Name;
-        target.Description = source.Description;
-        target.ResourceType = source.ResourceType;
-      }
-    }
-    #endregion // ResourceGroup
-  }
 }
Index: branches/ClientManagement/HeuristicLab.Services.Authentication/HeuristicLab.Services.Authentication/Interfaces/IClientService.cs
===================================================================
--- branches/ClientManagement/HeuristicLab.Services.Authentication/HeuristicLab.Services.Authentication/Interfaces/IClientService.cs	(revision 4802)
+++ branches/ClientManagement/HeuristicLab.Services.Authentication/HeuristicLab.Services.Authentication/Interfaces/IClientService.cs	(revision 4953)
@@ -36,5 +36,5 @@
         bool UpdateResourceGroup(ResourceGroup dto);
         [OperationContract]
-        bool DeleteResourceGroup(ResourceGroup id);
+        bool DeleteResourceGroup(ResourceGroup dto);
         #endregion
 
Index: branches/ClientManagement/HeuristicLab.Services.Authentication/Test/Program.cs
===================================================================
--- branches/ClientManagement/HeuristicLab.Services.Authentication/Test/Program.cs	(revision 4802)
+++ branches/ClientManagement/HeuristicLab.Services.Authentication/Test/Program.cs	(revision 4953)
@@ -3,5 +3,7 @@
 using System.Linq;
 using System.Text;
-using HeuristicLab.Services.Authentication.DataAccess;
+using HeuristicLab.Services.Authentication;
+using DA = HeuristicLab.Services.Authentication.DataAccess;
+using DT = HeuristicLab.Services.Authentication.DataTransfer;
 
 namespace Test
@@ -12,17 +14,22 @@
         {
 
-            ClientManagmentDataContext dc = new ClientManagmentDataContext(@"Data Source=nb-1\sqlexpress;Initial Catalog=HeuristicLab.ClientManagment;Integrated Security=SSPI;");
-          
-            if (dc.DatabaseExists()) {
-              Console.WriteLine("DB exsits");
-              dc.DeleteDatabase();
-              Console.WriteLine("DB deleted");
+            //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");
-                     
-            
-            Client c = new Client();
+
+            ClientService cs = new ClientService();
+
+            DT.Client c = new DT.Client();
 
             c.Id = Guid.NewGuid();
@@ -30,21 +37,31 @@
             c.Description = "Development-PC";
             c.IPAdress = "192.168.0.1";
+
             //c.ResourceType = "Client";
-            ResourceGroup r = new ResourceGroup();
+            DT.ResourceGroup r = new DT.ResourceGroup();
             r.Name = "test";
 
-            ResourceResourceGroup rrg = new ResourceResourceGroup();
-            rrg.ResourceGroup = r;
-            rrg.Client = c;
+            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<Resource>().InsertOnSubmit(r);
+            //dc.GetTable<Resource>().InsertOnSubmit(c);
 
-            dc.GetTable<ResourceResourceGroup>().InsertOnSubmit(rrg);
+            //dc.GetTable<ResourceResourceGroup>().InsertOnSubmit(rrg);
 
-            dc.SubmitChanges();
+            //dc.SubmitChanges();
 
+           
+           // cs.GetClients();
 
+            //cs.DeleteClient(c);
+           cs.DeleteResourceGroup(r);
 
 
Index: branches/ClientManagement/HeuristicLab.Services.Authentication/Test/Test.csproj
===================================================================
--- branches/ClientManagement/HeuristicLab.Services.Authentication/Test/Test.csproj	(revision 4802)
+++ branches/ClientManagement/HeuristicLab.Services.Authentication/Test/Test.csproj	(revision 4953)
@@ -53,4 +53,12 @@
       <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>
+      <Name>HeuristicLab.Services.Authentication</Name>
+    </ProjectReference>
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
Index: branches/ClientManagement/HeuristicLab.Services.Authentication/TestWebService/Properties/AssemblyInfo.cs
===================================================================
--- branches/ClientManagement/HeuristicLab.Services.Authentication/TestWebService/Properties/AssemblyInfo.cs	(revision 4953)
+++ branches/ClientManagement/HeuristicLab.Services.Authentication/TestWebService/Properties/AssemblyInfo.cs	(revision 4953)
@@ -0,0 +1,35 @@
+﻿using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("TestWebService")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("TestWebService")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("741f1630-a465-47ad-979b-0a15847bd4bd")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers 
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
Index: branches/ClientManagement/HeuristicLab.Services.Authentication/TestWebService/TestWebService.csproj
===================================================================
--- branches/ClientManagement/HeuristicLab.Services.Authentication/TestWebService/TestWebService.csproj	(revision 4953)
+++ branches/ClientManagement/HeuristicLab.Services.Authentication/TestWebService/TestWebService.csproj	(revision 4953)
@@ -0,0 +1,57 @@
+﻿<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>
+    </ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>741f1630-a465-47ad-979b-0a15847bd4bd</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>TestWebService</RootNamespace>
+    <AssemblyName>TestWebService</AssemblyName>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Core">
+      <RequiredTargetFramework>3.5</RequiredTargetFramework>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+      <Visible>False</Visible>
+    </CodeAnalysisDependentAssemblyPaths>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
Index: branches/ClientManagement/HeuristicLab.Services.Authentication/TestWebService/TestWebServiec.cs
===================================================================
--- branches/ClientManagement/HeuristicLab.Services.Authentication/TestWebService/TestWebServiec.cs	(revision 4953)
+++ branches/ClientManagement/HeuristicLab.Services.Authentication/TestWebService/TestWebServiec.cs	(revision 4953)
@@ -0,0 +1,22 @@
+﻿using System;
+using System.Text;
+using System.Collections.Generic;
+using System.Linq;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace TestWebService
+{
+    [TestClass]
+    public class WebserviceUnitTest
+    {
+        public void Init()
+        {
+            
+        }
+
+        [TestMethod]
+        public void TestMethod1()
+        {
+        }
+    }
+}
