def to_bytes(self):
        '''
        Create bytes from properties
        '''
        # Verify that properties make sense
        self.sanitize()

        # Start with the type
        bitstream = BitArray('uint:4=%d' % self.message_type)

        # Add the flags
        bitstream += BitArray('bool=%d, bool=%d, bool=%d'
                              % (self.probe,
                                 self.enlra_enabled,
                                 self.security))

        # Add padding
        bitstream += self._reserved1

        # Add record count
        bitstream += BitArray('uint:8=%d' % len(self.records))

        # Add the nonce
        nonce = bytes(self.nonce)
        if len(nonce) < 8:
            padding_len = 8 - len(nonce)
            bitstream += BitArray(8 * padding_len)

        bitstream += BitArray(bytes=nonce)

        # Add the map-reply records
        for record in self.records:
            bitstream += record.to_bitstream()

        # If the security flag is set then there should be security data here
        # TODO: deal with security flag [LISP-Security]
        if self.security:
            raise NotImplementedError('Handling security data is not ' +
                                      'implemented yet')

        return bitstream.bytes