code: public static void assignBidirectionalAssociations(Object object, Map source, PersistentEntity persistentEntity) {
          if (source == null) {
              return;
          }
  
          for (Object key : source.keySet()) {
              String propertyName = key.toString();
              if (propertyName.indexOf('.') > -1) {
                  propertyName = propertyName.substring(0, propertyName.indexOf('.'));
              }
              PersistentProperty prop = persistentEntity.getPropertyByName(propertyName);
  
              if (prop != null && prop instanceof OneToOne && ((OneToOne) prop).isBidirectional()) {
                  Object val = source.get(key);
                  PersistentProperty otherSide = ((OneToOne) prop).getInverseSide();
                  if (val != null && otherSide != null) {
                      MetaClass mc = GroovySystem.getMetaClassRegistry().getMetaClass(val.getClass());
                      try {
                          mc.setProperty(val, otherSide.getName(), object);
                      }
                      catch (Exception e) {
                          // ignore
                      }
                  }
              }
  
          }
      }
docs: Associations both sides of any bidirectional relationships found in the object and source map to bind
  
  @param object The object
  @param source The source map
  @param persistentEntity The PersistentEntity for the object