public NugetApiKeyEntity findByPrimaryPrincipal(
      final ODatabaseDocumentTx db, final String principal) {
    final OResultSet<ODocument> resultSet =
        db.command(new OSQLSynchQuery<ODocument>(SELECT_BY_PRIMARY_PRINCIPAL))
            .execute(checkNotNull(principal));

    if (resultSet.isEmpty()) {
      return null;
    }

    return readEntity(resultSet.iterator().next());
  }
  @Nullable
  public NugetApiKeyEntity findByApiKey(final ODatabaseDocumentTx db, final char[] apiKey) {
    final OResultSet<ODocument> resultSet =
        db.command(new OSQLSynchQuery<ODocument>(SELECT_BY_API_KEY))
            .execute(String.valueOf(checkNotNull(apiKey)));

    if (resultSet.isEmpty()) {
      return null;
    }

    return readEntity(resultSet.iterator().next());
  }