Move flagsAction() functionality into the user model