code: private static OptionalEntity<Role> getEntity(final CreateForm form) {
          switch (form.crudMode) {
          case CrudMode.CREATE:
              return OptionalEntity.of(new Role()).map(entity -> {
                  entity.setId(Base64.getUrlEncoder().encodeToString(form.name.getBytes(Constants.CHARSET_UTF_8)));
                  return entity;
              });
          case CrudMode.EDIT:
              if (form instanceof EditForm) {
                  return ComponentUtil.getComponent(RoleService.class).getRole(((EditForm) form).id);
              }
              break;
          default:
              break;
          }
          return OptionalEntity.empty();
      }
docs: ============