class SerializationUtil {

    public static String serialize(Serializable obj) {
        return Optional.ofNullable(obj)
                .map(SerializationUtils::serialize)
                .map(Base64.getEncoder()::encodeToString)
                .orElse(null);
    }

}