class RESTUtils {

    public static <T, U> Response checkNullableEntitiesAndRemap(T entity, U entity2,
                                                                BiFunction<T, U, ?> remapFunction) {
        if (entity != null && entity2 != null) {
            return okWithEntity(remapFunction.apply(entity, entity2));
        } else {
            return notFound();
        }
    }

}