class GroupDAO {

  public long createGroup(String name, String creator, String description, ImmutableMap<String, String> metadata) {
    GroupsRecord r = dslContext.newRecord(GROUPS);

    String jsonMetadata;
    try {
      jsonMetadata = mapper.writeValueAsString(metadata);
    } catch (JsonProcessingException e) {
      // Serialization of a Map<String, String> can never fail.
      throw Throwables.propagate(e);
    }

    long now = OffsetDateTime.now().toEpochSecond();

    r.setName(name);
    r.setCreatedby(creator);
    r.setCreatedat(now);
    r.setUpdatedby(creator);
    r.setUpdatedat(now);
    r.setDescription(description);
    r.setMetadata(jsonMetadata);
    r.store();

    return r.getId();
  }

  private  GroupDAO(DSLContext dslContext, GroupMapper groupMapper, ObjectMapper mapper);

}