public void RegisterUser(Client c) { UsersRepository ur = new UsersRepository(); RolesRepository rr = new RolesRepository(); ur.Entity = rr.Entity; if (ur.DoesUsernameExist(c.Username))//do or email aswell (do a method like the does username exists in the repository.. put the email verification in an else if statement { throw new Exception("Username already exists. Please input a different one"); } else if (ur.DoesEmailExist(c.Email)) { throw new Exception("Email already exists. Please input a different one"); } else { c.UserType = 2; ur.AddClient(c); Role defaultRole = rr.GetRoleById(2); //getting the user role from the database rr.AllocateRole(defaultRole, c); //allocating the role to the user } }