class InternalSerializationHelper {

    public static byte[] serializeState(RemoteBucketState state, Version backwardCompatibilityVersion) {
        try {
            ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
            DataOutputStream output = new DataOutputStream(byteStream);

            RemoteBucketState.SERIALIZATION_HANDLE.serialize(DataOutputSerializationAdapter.INSTANCE, output, state, backwardCompatibilityVersion, Scope.PERSISTED_STATE);

            output.close();
            byteStream.close();

            return byteStream.toByteArray();
        } catch (Exception e) {
            throw new IllegalStateException(e);
        }
    }

    public static RemoteBucketState deserializeState(byte[] bytes) {
        try {
            try (DataInputStream inputSteam = new DataInputStream(new ByteArrayInputStream(bytes))) {
                return RemoteBucketState.SERIALIZATION_HANDLE.deserialize(DataOutputSerializationAdapter.INSTANCE, inputSteam);
            }
        } catch (Exception e) {
            throw new IllegalStateException(e);
        }
    }

    public static byte[] serializeRequest(Request<?> request) {
        try {
            ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
            DataOutputStream output = new DataOutputStream(byteStream);

            Request.SERIALIZATION_HANDLE.serialize(DataOutputSerializationAdapter.INSTANCE, output, request, request.getBackwardCompatibilityVersion(), Scope.REQUEST);
            
            output.close();
            byteStream.close();

            return byteStream.toByteArray();
        } catch (Exception e) {
            throw new IllegalStateException(e);
        }
    }

    public static <T> Request<T> deserializeRequest(byte[] bytes) {<FILL_FUNCTION_BODY>}

    public static byte[] serializeResult(CommandResult<?> result, Version backwardCompatibilityVersion) {
        try {
            ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
            DataOutputStream output = new DataOutputStream(byteStream);

            CommandResult.SERIALIZATION_HANDLE.serialize(DataOutputSerializationAdapter.INSTANCE, output, result, backwardCompatibilityVersion, Scope.RESPONSE);

            output.close();
            byteStream.close();

            return byteStream.toByteArray();
        } catch (Exception e) {
            throw new IllegalStateException(e);
        }
    }

    public static <T> CommandResult<T> deserializeResult(byte[] bytes, Version backwardCompatibilityVersion) {
        try {
            try (DataInputStream inputSteam = new DataInputStream(new ByteArrayInputStream(bytes))) {
                return (CommandResult<T>) CommandResult.SERIALIZATION_HANDLE.deserialize(DataOutputSerializationAdapter.INSTANCE, inputSteam);
            }
        } catch (Exception e) {
            throw new IllegalStateException(e);
        }
    }

}

        try {
            try (DataInputStream inputSteam = new DataInputStream(new ByteArrayInputStream(bytes))) {
                return (Request<T>) Request.SERIALIZATION_HANDLE.deserialize(DataOutputSerializationAdapter.INSTANCE, inputSteam);
            }
        } catch (Exception e) {
            throw new IllegalStateException(e);
        }
    
<no_super_class>