1. Hubspot API Data Validation
Given the Hubspot API data containing two main entities, companies and employees, along with their existing relationships, you are required to validate a set of new relationships against two conditions: 1) A company can have a maximum of five employees holding the same position. 2) An employee can hold at most two positions within the same company. You need to categorize the new relationships into either 'validAssociation' or 'invalidAssociation' based on whether they violate the conditions. For example, if Hubspot already has four 'advisors' and the new relationships include two additional 'advisors', these would be placed in 'invalidAssociation' with a reason such as {"contactId": "xxx", "role": "advisor", "failureReason": "maximumExceeded"}. Similarly, if an employee named Jame already holds the positions of 'advisor' and 'counsellor' at Hubspot, any new position for Jame should also be placed in 'invalidAssociation'. Valid relationships should be added to 'validAssociation'. The results must then be submitted back to the provided API, and a correct answer will result in an immediate email confirmation.