I need to gather information about what picklist values are available for every record type. I know this can be achieved using either describeLayout or readMetadata API. But when I try to gather this info for a large custom object, troubles happen. The SalesForce API returns a record type with all available picklist values for it. 

```
<recordTypeMappings>
    <name>Record1</name>
    <picklistsForRecordType>
        <picklistName>Picklist1</picklistName>
        <picklistValues>
            ...
        </picklistValues>
    </picklistsForRecordType>
    <picklistsForRecordType>
        <picklistName>Picklist2</picklistName>
        <picklistValues>
            ...
        </picklistValues>
    </picklistsForRecordType>
</recordTypeMappings>
<recordTypeMappings>
    <name>Record2</name>
    <picklistsForRecordType>
        <picklistName>Picklist1</picklistName>
        <picklistValues>
            ...
        </picklistValues>
    </picklistsForRecordType>
    <picklistsForRecordType>
        <picklistName>Picklist2</picklistName>
        <picklistValues>
            ...
        </picklistValues>
    </picklistsForRecordType>
</recordTypeMappings>

```

It means if I have a large object (which includes 200 picklists and 100 record types), I will get 200\*100=20,000 picklist records. It makes the API response extremely large, up to 80MB. And this is extremely inefficient, if a picklist values remain the same for all record types, they will still be included in each of them in API response.

The idea is to get unique picklist values sets and then just include record ids with them, so the same picklist will not be duplicated with every record type. 

```
<recordTypeMappings>
    <name>Record1, Record2</name>
    <picklistsForRecordType>
        <picklistName>Picklist1</picklistName>
        <picklistValues>
            ...Values which are the same for Record1 and Record2...
        </picklistValues>
    </picklistsForRecordType>
    <picklistsForRecordType>
        <picklistName>Picklist2</picklistName>
        <picklistValues>
            ...Values which are the same for Record1 and Record2...
        </picklistValues>
    </picklistsForRecordType>
</recordTypeMappings>

```

This will reduce the response size. Is there a way to do that in Apex? I searched in API and was not able to find anything suitable. Apex seems a better solution, since all the processing will happen on the Salesforce side.

Thanks for help.