+ /**
+ * Prepare field data for update/insert
+ *
+ * @param array $fields
+ * @return array prepared fields
+ */
+ private static function preparedFields(array $fields): array
+ {
+ unset($fields['uid']);
+ unset($fields['cid']);
+ unset($fields['uri-id']);
+
+ if (isset($fields['readonly'])) {
+ $fields['ignored'] = $fields['readonly'];
+ }
+
+ if (!empty($fields['self'])) {
+ $fields['rel'] = Contact::SELF;
+ }
+
+ return DBStructure::getFieldsForTable('user-contact', $fields);
+ }
+