async function loadSeedData(appLog, config, models) {
  const seedDataPath = config.get('seedDataPath');

  const resolved = path.resolve(seedDataPath);
  appLog.info('Loading seed data from %s', resolved);

  if (!seedDataPath || !dirExists(seedDataPath)) {
    return;
  }

  const queries = await getItemDirectoryData(appLog, seedDataPath, 'queries');
  for (const query of queries) {
    const existing = await models.queries.findOneById(query.id);

    // Find actual createdBy user.
    // query.createdBy could be email or user id
    let createdByUser = await findOrCreateUserReference(
      models,
      query.createdBy
    );
    let updatedByUser = createdByUser;
    if (query.updatedBy) {
      updatedByUser = await findOrCreateUserReference(models, query.updatedBy);
    }

    if (query.acl) {
      for (const acl of query.acl) {
        let fieldCount = 0;
        if (acl.userId) {
          fieldCount += 1;
        }
        if (acl.userEmail) {
          fieldCount += 1;
        }
        if (acl.groupId) {
          fieldCount += 1;
        }
        if (fieldCount > 1) {
          throw new Error(
            'Query seed import - only specify one of userId, userEmail, or groupId'
          );
        }

        if (acl.userEmail) {
          const aclUser = await findOrCreateUserReference(
            models,
            acl.userEmail
          );
          delete acl.userEmail;
          acl.userId = aclUser.id;
        }
      }
    }

    const data = {
      ...existing,
      ...query,
      createdBy: createdByUser.id,
      updatedBy: updatedByUser.id,
    };

    // TODO - only update query if query data is different
    // Aways updating is causing updatedAt to change, which is bringing these results to the top of UI
    // This will require taking a subset of query data and performing a deep equal
    if (existing) {
      await models.queries.update(existing.id, data);
    } else {
      await models.queries.create(data);
    }
  }

  const connections = await getItemDirectoryData(
    appLog,
    seedDataPath,
    'connections'
  );
  for (const connection of connections) {
    const existing = await models.connections.findOneById(connection.id);
    if (existing) {
      await models.connections.update(existing.id, connection);
    } else {
      await models.connections.create(connection);
    }
  }
}
@param {*} appLog
@param {*} config
@param {import('../models')} models