Multi select dependant dropdown list

Multi select dependant dropdown list


There are two dropdowns (categories and products)


First dropdown
C1
C2
C3
C4

Second dropdown is dynamic dropdown and it gets populated based on whats selected in first dropdown

For C1
P1A, P1B, P1C would get populated in second dropdown

For C2
P2A,

For C3
P3A, P3B, P3C

For C4
P4A, P4B

I want to give user the ability to select multiple combinations of categories and products

So, if he selects C1 and then P1A/P1B, C3 and then P3B
I want to send to the server on submit the selected key value pairs
(C1, P1A),  (C1, P1B),  (C3, P3B) 
OR
(C1->[P1A, P1B] C3-> [P1A])


I looked up the jquery plugins and all of them are multi select dropdowns but I couldn't find any multi select dependent dropdowns in which both are multi select ( http://jquery-plugins.net/tag/select-list / http://wenzhixin.net.cn/p/multiple-select/ / http://www.jqueryscript.net/demo/Dynamic-jQuery-Cascading-Dropdown-Lists-Plugin/)
Any ideas?