function getProjectLabels(){
        var allLabels = {};
        $("#labelIds > optgroup").each(function(){
            var allLabelsOfTheCategory = [];
            var categoryId;
            $(this).children().each(function(){
                $this = $(this);
                allLabelsOfTheCategory.push($this.val());
                categoryId = $this.data("categoryId")
            });

            allLabels[categoryId] = allLabelsOfTheCategory;
        });
        return allLabels;
    }
It gather all project labels.
 Category id is used for the key.
 Label ids are used for the value.
 {
    31: [130, 120, ...],
    70: [200, 201, 320, ...]
 }