Associate records in plugin

When creating N:N relationships between entities, CRM allow us to associate records. This is a great functionality to track and reference records through entities. Although this can be done manually, find below a method to associate two records programmatically:  

Strange error on lookup CRM 365

As described in the title, today I had to fix a pretty strange error that was appearing on two Lookups whenever I tried to change their values in the form. Basically, after clicking on any of these two fields, CRM was throwing the next error: Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: System.Xml.XmlException: Microsoft Dynamics … Continue reading Strange error on lookup CRM 365