code: @Override
      protected void encode(ByteArrayOutputStream buffer) throws IOException
      {
          buffer.write(UtilConversion.shortToByteArray(entityId));
          final Collection<M> keys = actions.keySet();
  
          // Fill the data
          buffer.write((byte) keys.size());
          for (final M key : keys)
          {
              encode(buffer, key);
          }
      }
docs: Retrieve the keys, store its total number in the buffer, and call {@link #encode(ByteArrayOutputStream, Enum) for
  each key}.
  
  @param buffer The current buffer to write.
  @throws IOException Exception in case of error.