public AppUser CreateNewAccount(AUser user) { //get role var role = context.Roles.SingleOrDefault(e => e.Id == (int)SupportLayer.Enum.RoleType.Admin); //create App var pipe = new DefualtPipeForCreateApp(); var app = new CDefualtApp(); var factory = AppFactory.CreateApp <DefaultAppBuilder>(pipe); factory.CreateApp(app); //create User var cum = new CUserManager(); cum.AddUser(user, app); cum.AddUserRole(user, role); cum.Save(); }