public void DeAllocateRole(int roleId, String username) { RolesRepository rr = new RolesRepository(); Role r = rr.GetRoleById(roleId);//getting the role UsersRepository ur = new UsersRepository(); ur.Entity = rr.Entity; //we put the repositries in the same locations so that we can call multiple repositories //it is important to do this line before you use the second method (getUSer) Client u = ur.GetClient(username); //getting the user if (rr.IsUserInRole(username, roleId) == true) { rr.DeAllocateRole(r, u); } else { throw new Exception("Role is not allocated to that user"); } }