public EnvironmentRevision createEnvironmentRevision(
      @NonNull final EnvironmentRevision environmentRevision)
      throws ResourceExistsException, InternalServiceException {

    final EnvironmentRevisionDDBRecord environmentRevisionDDBRecord =
        environmentMapper.toEnvironmentRevisionDDBRecord(environmentRevision);

    try {
      dynamoDBMapper.save(environmentRevisionDDBRecord);

    } catch (final ConditionalCheckFailedException e) {
      throw new ResourceExistsException(
          ResourceType.ENVIRONMENT_REVISION,
          environmentRevisionDDBRecord.getEnvironmentRevisionId());

    } catch (final AmazonServiceException e) {
      throw new InternalServiceException(
          String.format(
              "Could not save record with environment revision id %s",
              environmentRevision.getEnvironmentRevisionId()),
          e);
    }

    return environmentMapper.toEnvironmentRevision(environmentRevisionDDBRecord);
  }
Check if environment revisions exist and clean them up.
data-service/src/main/java/com/amazonaws/blox/dataservice/repository/EnvironmentRepositoryDDB.java