async function writeEvents(entry) {
  const entryJson = {
    workspaceId: entry.workspaceId,
    entryNumber: entry.entryNumber,
    events: entry.events.map((event) => event.toJson()),
  };
  const response = await fetch('/api/events/add', {
    method: 'POST',
    body: JSON.stringify({entry: entryJson}),
  });
  if (response.status === 200) {
    return;
  } else {
    throw 'Failed to write to database.';
  }
}
Add an entry to database.
@param {!LocalEntry} entry The LocalEntry objects to be added to the
database.
@throws Will throw an error if the response status code is not 200.
@public