@Override
  public ChangeSet add(final ChangeSet changeSet) {
    if (LOG.isDebugEnabled()) {
      LOG.debug("Add a change set: " + changeSet);
    }

    String groupId = changeSetMemberDao.generateChangeSetGroupId();
    changeSet.addAssignedUser(changeSet.getCreatedByUserGuid());

    // for consistency, always use the time service to set the created date
    changeSet.setCreatedDate(timeService.getCurrentTime());

    // if no state code was set the default is OPEN
    if (changeSet.getStateCode() == null) {
      changeSet.setStateCode(ChangeSetStateCode.OPEN);
    }

    getChangeSetMutator(changeSet).setObjectGroupId(groupId);
    return changeSetDao.add(changeSet);
  }