diff --git a/core/modules/entity/entity.module b/core/modules/entity/entity.module
index 7622b1d..fab79d5 100644
--- a/core/modules/entity/entity.module
+++ b/core/modules/entity/entity.module
@@ -468,7 +468,7 @@ function entity_form_field_validate($entity_type, $form, &$form_state) {
  * @return Drupal\entity\EntityFormController
  *   An instance of the Drupal\Core\Entity\FormController class.
  */
-function entity_get_form_controller($entity_type, $context = 'default') {
+function entity_form_controller($entity_type, $context = 'default') {
   $info = entity_get_info($entity_type);
 
   // Check whether there is a form controller class for the specified context.
@@ -488,9 +488,9 @@ function entity_get_form_controller($entity_type, $context = 'default') {
 }
 
 /**
- * Returns the form id for the given entity.
+ * Returns the form id for the given entity and context.
  */
-function _entity_form_id(EntityInterface $entity, $context = 'default') {
+function entity_form_id(EntityInterface $entity, $context = 'default') {
   $entity_type = $entity->entityType();
   $bundle = $entity->bundle();
   $form_id = $entity_type;
@@ -504,7 +504,7 @@ function _entity_form_id(EntityInterface $entity, $context = 'default') {
 }
 
 /**
- * Returns the rendered entity form for the given entity and context.
+ * Returns the default form state for the given entity and context.
  *
  * @param EntityInterface $entity
  *   The entity to be created or edited.
@@ -512,16 +512,50 @@ function _entity_form_id(EntityInterface $entity, $context = 'default') {
  *   (optional) The context for the form to be returned.
  *
  * @return
- *   A rendered edit form for the given entity.
+ *   A $form_state array already filled the entity form controller.
  */
-function entity_get_form(EntityInterface $entity, $context = 'default') {
-  $controller = entity_get_form_controller($entity->entityType(), $context);
-
+function entity_form_state_defaults(EntityInterface $entity, $context = 'default') {
+  $form_state = array();
+  $controller = entity_form_controller($entity->entityType(), $context);
   $form_state['build_info']['callback'] = array($controller, 'build');
   $form_state['build_info']['base_form_id'] = $entity->entityType() . '_form';
   $form_state['build_info']['args'] = array($entity);
+  return $form_state;
+}
+
+/**
+ * Retrieves, populates, and processes an entity form.
+ *
+ * @param EntityInterface $entity
+ *   The entity to be created or edited.
+ * @param $context
+ *   (optional) The context for the form to be returned.
+ * @param $form_state
+ *   (optional) A keyed array containing the current state of the form.
+ *
+ * @return
+ *   A $form_state array already filled with the entity form controller.
+ */
+function entity_form_submit(EntityInterface $entity, $context = 'default', &$form_state = array()) {
+  $form_state += entity_form_state_defaults($entity, $context);
+  $form_id = entity_form_id($entity, $context);
+  drupal_form_submit($form_id, $form_state);
+}
 
-  $form_id = _entity_form_id($entity, $context);
+/**
+ * Returns the rendered entity form for the given entity and context.
+ *
+ * @param EntityInterface $entity
+ *   The entity to be created or edited.
+ * @param $context
+ *   (optional) The context for the form to be returned.
+ *
+ * @return
+ *   A rendered edit form for the given entity.
+ */
+function entity_get_form(EntityInterface $entity, $context = 'default') {
+  $form_state = entity_form_state_defaults($entity, $context);
+  $form_id = entity_form_id($entity, $context);
   return drupal_build_form($form_id, $form_state);
 }
 
diff --git a/core/modules/openid/openid.module b/core/modules/openid/openid.module
index e7dbfb9..df076f8 100644
--- a/core/modules/openid/openid.module
+++ b/core/modules/openid/openid.module
@@ -733,11 +733,7 @@ function openid_authentication($response) {
     $form_state['values'] = array();
     $form_state['values']['op'] = t('Create new account');
     $account = entity_create('user', array());
-    $controller = entity_get_form_controller($account->entityType(), 'register');
-    $form_state['build_info']['callback'] = array($controller, 'build');
-    $form_state['build_info']['base_form_id'] = 'user_form';
-    $form_state['build_info']['args'] = array(entity_create('user', array()), 'register');
-    drupal_form_submit('user_register_form', $form_state);
+    entity_form_submit($account, 'register', $form_state);
 
     if (empty($form_state['user'])) {
       module_invoke_all('openid_response', $response, NULL);
