/**
  * Store the data of a sub form field.
  *
  * @param int      $fieldId   The field id.
  * @param int|bool $leadStore The lead store field or setting.
  *
  * @return void
  */
 private function storeSubformFieldData($fieldId, $leadStore)
 {
     $field = \FormFieldModel::findByPK($fieldId);
     $data = array();
     if ($this->hasLeadMaster()) {
         $masterField = \FormFieldModel::findByPk($leadStore);
         if (!$masterField) {
             return;
         }
         $fieldName = $masterField->name;
         $masterId = $masterField->id;
     } else {
         $fieldName = $field->name;
         $masterId = $field->id;
     }
     // Regular data
     if (isset($this->postData[$field->name])) {
         $value = \Leads::prepareValue($this->postData[$field->name], $field);
         $label = \Leads::prepareLabel($value, $field);
         $data = array('pid' => $this->leadId, 'sorting' => $field->sorting, 'tstamp' => time(), 'master_id' => $masterId, 'field_id' => $field->id, 'name' => $fieldName, 'value' => $value, 'label' => $label);
     }
     // Files
     if (isset($this->files[$field->name]) && $this->files[$field->name]['uploaded']) {
         $value = \Leads::prepareValue($this->files[$field->name], $field);
         $label = \Leads::prepareLabel($value, $field);
         $data = array('pid' => $this->leadId, 'sorting' => $field->sorting, 'tstamp' => time(), 'master_id' => $field->master_id, 'field_id' => $field->id, 'name' => $field->name, 'value' => $value, 'label' => $label);
     }
     $this->insertIntoDatabase($field, $data);
 }