class GroupCreationWorkflow implements IsWidget {

    protected void createGroup(final String name) {
        final Group _group = userSystemManager.createGroup(name);
        createEntity.clear();
        loadingBox.show();
        userSystemManager.groups(new RemoteCallback<Group>() {
                                     @Override
                                     public void callback(Group group) {
                                         GroupCreationWorkflow.this.group = group;
                                         final boolean isEmptyUsersAllowed = userSystemManager.getGroupManagerSettings().allowEmpty();
                                         loadingBox.hide();
                                         if (!isEmptyUsersAllowed) {
                                             showUsersAssignment(name);
                                         } else {
                                             confirmBox.show(UsersManagementWidgetsConstants.INSTANCE.confirmAction(),
                                                             UsersManagementWidgetsConstants.INSTANCE.assignUsersToGroupName() + " " + name,
                                                             new Command() {
                                                                 @Override
                                                                 public void execute() {
                                                                     showUsersAssignment(name);
                                                                 }
                                                             },
                                                             new Command() {
                                                                 @Override
                                                                 public void execute() {
                                                                     fireGroupCreated(name);
                                                                     create();
                                                                 }
                                                             });
                                         }
                                     }
                                 },
                                 errorCallback).create(_group);
    }

    @Inject public  GroupCreationWorkflow(final ClientUserSystemManager userSystemManager,
                                 final Caller<AuthorizationService> authorizationService,
                                 final PermissionManager permissionManager,
                                 final Event<OnErrorEvent> errorEvent,
                                 final ConfirmBox confirmBox,
                                 final LoadingBox loadingBox,
                                 final Event<NotificationEvent> workbenchNotification,
                                 final CreateEntity createEntity,
                                 final GroupUsersAssignment groupUsersAssignment,
                                 final Event<CreateGroupEvent> onCreateGroupEvent,
                                 final EntityWorkflowView view);

}