code: func (s *Server) handleWriteRequest(r WriteRequest) []byte {
  	// Validate the request.
  	switch {
  	case len(r) < 3:
  		return newErrorResponse(r.AttributeOpcode(), 0x0000, ble.ErrInvalidPDU)
  	}
  
  	a, ok := s.db.at(r.AttributeHandle())
  	if !ok {
  		return newErrorResponse(r.AttributeOpcode(), r.AttributeHandle(), ble.ErrInvalidHandle)
  	}
  
  	// We don't support write to static value. Pass the request to upper layer.
  	if a == nil {
  		return newErrorResponse(r.AttributeOpcode(), r.AttributeHandle(), ble.ErrWriteNotPerm)
  	}
  	if e := handleATT(a, s.conn, r, ble.NewResponseWriter(nil)); e != ble.ErrSuccess {
  		return newErrorResponse(r.AttributeOpcode(), r.AttributeHandle(), e)
  	}
  	return []byte{WriteResponseCode}
  }
docs: // handle Write request. [Vol 3, Part F, 3.4.5.1 & 3.4.5.2]