protected static function saveFieldData($entry_id, $field_id, $field)
    {
        // Check that we have a field id
        if (empty($field_id)) {
            return;
        }

        // Ignore parameter when not an array
        if (!is_array($field)) {
            $field = array();
        }

        $did_lock = false;
        $exception = null;
        try {

            // Check if table exists
            $table_name = 'tbl_entries_data_' . General::intval($field_id);
            if (!Symphony::Database()->tableExists($table_name)) {
                return;
            }

            // Lock the table for write
            $did_lock = Symphony::Database()->query("LOCK TABLES `$table_name` WRITE");

            // Delete old data
            Symphony::Database()->delete($table_name, sprintf("
                `entry_id` = %d", $entry_id
            ));

            // Insert new data
            $data = array(
                'entry_id' => $entry_id
            );

            $fields = array();

            foreach ($field as $key => $value) {
                if (is_array($value)) {
                    foreach ($value as $ii => $v) {
                        $fields[$ii][$key] = $v;
                    }
                } else {
                    $fields[max(0, count($fields) - 1)][$key] = $value;
                }
            }

            foreach ($fields as $index => $field_data) {
                $fields[$index] = array_merge($data, $field_data);
            }

            // Insert only if we have field data
            if (!empty($fields)) {
                Symphony::Database()->insert($fields, $table_name);
            }
        } catch (Exception $ex) {
            $exception = $ex;
            Symphony::Log()->pushExceptionToLog($ex, true);
        }

        if ($did_lock) {
            Symphony::Database()->query('UNLOCK TABLES');
        }

        if ($exception) {
            throw $exception;
        }
    }