diff --git a/CRM/Contribute/Form/AbstractEditPayment.php b/CRM/Contribute/Form/AbstractEditPayment.php
index 04be631bb138..9c5ca6cf14ed 100644
--- a/CRM/Contribute/Form/AbstractEditPayment.php
+++ b/CRM/Contribute/Form/AbstractEditPayment.php
@@ -77,13 +77,6 @@ class CRM_Contribute_Form_AbstractEditPayment extends CRM_Contact_Form_Task {
    */
   protected $_paymentObject;
 
-  /**
-   * The id of the contribution that we are processing.
-   *
-   * @var int
-   */
-  public $_id;
-
   /**
    * Entity that $this->_id relates to.
    *
diff --git a/CRM/Core/Form/EntityFormTrait.php b/CRM/Core/Form/EntityFormTrait.php
index 15ff60830a79..5ebf4441e8f8 100644
--- a/CRM/Core/Form/EntityFormTrait.php
+++ b/CRM/Core/Form/EntityFormTrait.php
@@ -16,6 +16,13 @@
  */
 trait CRM_Core_Form_EntityFormTrait {
 
+  /**
+   * The id of the object being edited / created.
+   *
+   * @var int
+   */
+  public $_id;
+
   /**
    * The entity subtype ID (eg. for Relationship / Activity)
    *
@@ -71,6 +78,15 @@ public function getEntityId() {
     return $this->_id;
   }
 
+  /**
+   * Set the entity ID
+   *
+   * @param int $id The entity ID
+   */
+  public function setEntityId($id) {
+    $this->_id = $id;
+  }
+
   /**
    * Should custom data be suppressed on this form.
    *
diff --git a/CRM/Member/Form.php b/CRM/Member/Form.php
index 40e66ca63f3d..1408396dafdd 100644
--- a/CRM/Member/Form.php
+++ b/CRM/Member/Form.php
@@ -22,12 +22,6 @@
 class CRM_Member_Form extends CRM_Contribute_Form_AbstractEditPayment {
 
   use CRM_Core_Form_EntityFormTrait;
-  /**
-   * The id of the object being edited / created
-   *
-   * @var int
-   */
-  public $_id;
 
   /**
    * Membership Type ID
diff --git a/CRM/UF/Form/Group.php b/CRM/UF/Form/Group.php
index f531dfbbb840..90f7528c4973 100644
--- a/CRM/UF/Form/Group.php
+++ b/CRM/UF/Form/Group.php
@@ -90,13 +90,6 @@ public function getDefaultEntity() {
     return 'UFGroup';
   }
 
-  /**
-   * The form id saved to the session for an update.
-   *
-   * @var int
-   */
-  protected $_id;
-
   /**
    * The title for group.
    *