protected void addToBlockList( User user, List<JID> toBlocks )
    {
        if ( toBlocks == null || toBlocks.isEmpty() )
        {
            return;
        }

        Log.debug( "Obtain or create a the default privacy list for '{}'", user.getUsername() );
        PrivacyList defaultPrivacyList = PrivacyListManager.getInstance().getDefaultPrivacyList( user.getUsername() );
        if ( defaultPrivacyList == null )
        {
            final Element listElement = DocumentFactory.getInstance().createDocument().addElement( "list", "jabber:iq:privacy" );
            listElement.addAttribute( "name", "blocklist" );

            defaultPrivacyList = PrivacyListManager.getInstance().createPrivacyList( user.getUsername(), "blocklist", listElement );
            PrivacyListManager.getInstance().changeDefaultList( user.getUsername(), defaultPrivacyList, null );
        }

        Log.debug( "Adding {} JIDs as blocked items to the beginning of list '{}' (belonging to '{}')", toBlocks.size(), defaultPrivacyList.getName(), user.getUsername() );
        final Element listElement = defaultPrivacyList.asElement();
        for ( int i = 0; i < toBlocks.size(); i++ )
        {
            final Element element = DocumentHelper.createElement( "item" )
                .addAttribute( "type", "jid" )
                .addAttribute( "value", toBlocks.get( i ).toString() )
                .addAttribute( "action", "deny" )
                .addAttribute( "order", Integer.toString( i ) );
            listElement.elements().add( i, element );
        }

        Log.debug( "Iterating over all items of list '{}' (belonging to '{}'), to ensure that their 'order' value is unique.", defaultPrivacyList.getName(), user.getUsername() );
        final List<Element> elements = listElement.elements();
        for ( int i = 0; i < elements.size(); i++ )
        {
            elements.get( i ).attribute( "order" ).setValue( Integer.toString( i ) );
        }

        defaultPrivacyList.updateList( listElement );
        PrivacyListProvider.getInstance().updatePrivacyList( user.getUsername(), defaultPrivacyList );
    }
Adds a collection of JIDs to the blocklist of the provided user.

This method adds the JIDs to the default privacy list, creating a new privacy list (and setting it as default)
if the user does not have a default privacy list.

The newly added JIDs are push on the front end of the list. The order of pre-existing list items is modified.

@param user     The owner of the blocklist to which JIDs are to be added (cannot be null).
@param toBlocks The JIDs to be added (can be null, which results in a noop).
xmppserver/src/main/java/org/jivesoftware/openfire/handler/IQBlockingHandler.java