diff --git a/epicardium/ble/ble_main.c b/epicardium/ble/ble_main.c
index a5522b4e741413cc2af4d239ac96d9dd8fa5c7a2..35024f6aa26cd8fdf9f0fc2b6e5ddeeb04b76775 100644
--- a/epicardium/ble/ble_main.c
+++ b/epicardium/ble/ble_main.c
@@ -394,6 +394,7 @@ static void bleCccCback(attsCccEvt_t *pEvt)
   {
     /* store value in device database */
     AppDbSetCccTblValue(dbHdl, pEvt->idx, pEvt->value);
+    AppDbNvmStoreCccTbl(dbHdl);
   }
 
   if ((pMsg = WsfMsgAlloc(sizeof(attsCccEvt_t))) != NULL)
@@ -761,6 +762,10 @@ static void bleProcMsg(bleMsg_t *pMsg)
     case DM_SEC_PAIR_CMPL_IND:
       LOG_INFO("ble", "Secure pairing successful, auth: 0x%02X",
                pMsg->dm.pairCmpl.auth);
+
+      DmSecGenerateEccKeyReq();
+      AppDbNvmStoreBond(AppDbGetHdl((dmConnId_t) pMsg->hdr.param));
+
       pair_connId = DM_CONN_ID_NONE;
       trigger_event(BLE_EVENT_PAIRING_COMPLETE);
       /* After a successful pairing, bonding is disabled again.
@@ -783,6 +788,9 @@ static void bleProcMsg(bleMsg_t *pMsg)
                    pMsg->hdr.status);
           break;
       }
+
+      DmSecGenerateEccKeyReq();
+
       pair_connId = DM_CONN_ID_NONE;
       trigger_event(BLE_EVENT_PAIRING_FAILED);
       break;
diff --git a/epicardium/ble/bondings.c b/epicardium/ble/bondings.c
index 910c8f26f7af2e92316efe56a340e39c28914578..3620ba3a7830753161ac1c153360947774cd3fc9 100644
--- a/epicardium/ble/bondings.c
+++ b/epicardium/ble/bondings.c
@@ -425,11 +425,6 @@ void AppDbValidateRecord(appDbHdl_t hdl, uint8_t keyMask)
 {
   ((appDbRec_t *) hdl)->valid = TRUE;
   ((appDbRec_t *) hdl)->keyValidMask = keyMask;
-  char filename[32];
-  record_to_filename((appDbRec_t *) hdl, filename, sizeof(filename));
-  /* Directory might exist already. Call will fail silently in that case. */
-  epic_file_mkdir("pairings");
-  write_bond_to_file((appDbRec_t *) hdl, filename);
 }
 
 /*************************************************************************************************/
@@ -697,10 +692,6 @@ void AppDbSetCccTblValue(appDbHdl_t hdl, uint16_t idx, uint16_t value)
   WSF_ASSERT(idx < APP_DB_NUM_CCCD);
 
   ((appDbRec_t *) hdl)->cccTbl[idx] = value;
-
-  char filename[32];
-  record_to_filename((appDbRec_t *) hdl, filename, sizeof(filename));
-  write_bond_to_file((appDbRec_t *) hdl, filename);
 }
 
 /*************************************************************************************************/
@@ -878,4 +869,41 @@ void AppDbSetPeerRpao(appDbHdl_t hdl, bool_t peerRpao)
 {
   ((appDbRec_t *)hdl)->peerRpao = peerRpao;
 }
+
+/*************************************************************************************************/
+/*!
+ *  \brief  Store the client characteristic configuration table for a device record in NVM.
+ *
+ *  \param  hdl       Database record handle.
+ *
+ *  \return None.
+ */
+/*************************************************************************************************/
+void AppDbNvmStoreCccTbl(appDbHdl_t hdl)
+{
+  /* We take a short cut and simply write the whole file again. */
+  AppDbNvmStoreBond(hdl);
+}
+
+/*************************************************************************************************/
+/*!
+ *  \brief  Store bonding information for device record in NVM.
+ *
+ *  \param  hdl       Database record handle.
+ *
+ *  \return None.
+ */
+/*************************************************************************************************/
+void AppDbNvmStoreBond(appDbHdl_t hdl)
+{
+  appDbRec_t  *pRec = (appDbRec_t *) hdl;
+
+  if (pRec->inUse && pRec->valid) {
+    char filename[32];
+    record_to_filename(pRec, filename, sizeof(filename));
+    /* Directory might exist already. Call will fail silently in that case. */
+    epic_file_mkdir("pairings");
+    write_bond_to_file(pRec, filename);
+  }
+}
 /* clang-format on */
diff --git a/lib/sdk/Libraries/BTLE/stack/ble-profiles/include/app/app_db.h b/lib/sdk/Libraries/BTLE/stack/ble-profiles/include/app/app_db.h
index e72fb4cf8d3b5ac912d66f70fa01c634546ae146..a34b6d3bbb1e20444d3892f34d4e20e915ddd4e4 100644
--- a/lib/sdk/Libraries/BTLE/stack/ble-profiles/include/app/app_db.h
+++ b/lib/sdk/Libraries/BTLE/stack/ble-profiles/include/app/app_db.h
@@ -395,6 +395,28 @@ bool_t AppDbGetPeerRpao(appDbHdl_t hdl);
 /*************************************************************************************************/
 void AppDbSetPeerRpao(appDbHdl_t hdl, bool_t peerRpao);
 
+/*************************************************************************************************/
+/*!
+ *  \brief  Store the client characteristic configuration table for a device record in NVM.
+ *
+ *  \param  hdl       Database record handle.
+ *
+ *  \return None.
+ */
+/*************************************************************************************************/
+void AppDbNvmStoreCccTbl(appDbHdl_t hdl);
+
+/*************************************************************************************************/
+/*!
+ *  \brief  Store bonding information for device record in NVM.
+ *
+ *  \param  hdl       Database record handle.
+ *
+ *  \return None.
+ */
+/*************************************************************************************************/
+void AppDbNvmStoreBond(appDbHdl_t hdl);
+
 /**@}*/
 
 /*! \} */    /*! APP_FRAMEWORK_DB_API */