class NpmMetadataUtils {

  public static DateTime maintainTime(final NestedAttributesMap packageRoot) {
    final NestedAttributesMap time = packageRoot.child(TIME);
    final DateTime now = DateTime.now();
    final String nowString = NPM_TIMESTAMP_FORMAT.print(now);
    if (!time.contains(CREATED)) {
      time.set(CREATED, nowString);
    }
    time.set(MODIFIED, nowString);
    for (String version : packageRoot.child(VERSIONS).keys()) {
      if (!time.contains(version)) {
        time.set(version, nowString);
      }
    }
    return now;
  }

  private  NpmMetadataUtils();

}