class AbstractBinaryTransaction {

    private final byte[] requestBytes;
    private Version backwardCompatibilityVersion;
    private Request<?> request;
    private long currentTimeNanos;

    protected AbstractBinaryTransaction(byte[] requestBytes) {
        this.requestBytes = requestBytes;
    }

    public byte[] execute() {<FILL_FUNCTION_BODY>}

    protected abstract byte[] getRawState();

    protected abstract void setRawState(byte[] newStateBytes, RemoteBucketState newState);

    public abstract boolean exists();

    protected Request<?> getRequest() {
        return request;
    }

    protected ExpirationAfterWriteStrategy getExpirationStrategy() {
        return request.getExpirationStrategy();
    }

    protected long getCurrentTimeNanos() {
        return currentTimeNanos;
    }
}

        try {
            request = InternalSerializationHelper.deserializeRequest(requestBytes);
        } catch (UnsupportedTypeException e) {
            return serializeResult(CommandResult.unsupportedType(e.getTypeId()), Versions.getOldest());
        } catch (UsageOfUnsupportedApiException e) {
            return serializeResult(CommandResult.usageOfUnsupportedApiException(e.getRequestedFormatNumber(), e.getMaxSupportedFormatNumber()), Versions.getOldest());
        } catch (UsageOfObsoleteApiException e) {
            return serializeResult(CommandResult.usageOfObsoleteApiException(e.getRequestedFormatNumber(), e.getMinSupportedFormatNumber()), Versions.getOldest());
        }

        backwardCompatibilityVersion = request.getBackwardCompatibilityVersion();

        try {
            RemoteBucketState currentState = null;
            if (exists()) {
                byte[] stateBytes = getRawState();
                currentState = deserializeState(stateBytes);
            }
            MutableBucketEntry entryWrapper = new MutableBucketEntry(currentState);

            currentTimeNanos = request.getClientSideTime() != null? request.getClientSideTime(): System.currentTimeMillis() * 1_000_000;
            RemoteCommand<?> command = request.getCommand();
            CommandResult<?> result = command.execute(entryWrapper, currentTimeNanos);

            if (entryWrapper.isStateModified()) {
                RemoteBucketState newState = entryWrapper.get();
                setRawState(serializeState(newState, backwardCompatibilityVersion), newState);
            }

            return serializeResult(result, request.getBackwardCompatibilityVersion());
        } catch (UnsupportedTypeException e) {
            return serializeResult(CommandResult.unsupportedType(e.getTypeId()), backwardCompatibilityVersion);
        } catch (UsageOfUnsupportedApiException e) {
            return serializeResult(CommandResult.usageOfUnsupportedApiException(e.getRequestedFormatNumber(), e.getMaxSupportedFormatNumber()), backwardCompatibilityVersion);
        } catch (UsageOfObsoleteApiException e) {
            return serializeResult(CommandResult.usageOfObsoleteApiException(e.getRequestedFormatNumber(), e.getMinSupportedFormatNumber()), backwardCompatibilityVersion);
        }
    
<no_super_class>