docs: Optional<EntityDescriptor> referencingEntity(AttributeDescriptor attribute) {
          if (!Names.isEmpty(attribute.referencedTable())) {
              // match by table name
              return entities.values().stream()
                  .filter(entity -> entity.tableName().equalsIgnoreCase(attribute.referencedTable()))
                  .findFirst();
  
          } else if (!Names.isEmpty(attribute.referencedType())) {
              // match by type name
              Optional<TypeKind> primitiveType = Stream.of(TypeKind.values())
                  .filter(TypeKind::isPrimitive)
                  .filter(kind -> kind.toString().toLowerCase().equals(attribute.referencedType()))
                  .findFirst();
              if (!primitiveType.isPresent()) {
                  QualifiedName referencedType = new QualifiedName(attribute.referencedType());
                  return entityByName(referencedType);
              } // else attribute is basic foreign key and not referring to an entity
          } else {
              TypeMirror referencedType = attribute.typeMirror();
              if (attribute.isIterable()) {
                  referencedType = collectionElementType(referencedType);
              }
              TypeElement referencedElement = (TypeElement) types.asElement(referencedType);
              if (referencedElement != null) {
                  String referencedName = referencedElement.getSimpleName().toString();
                  return entities.values().stream()
                          .filter(entity -> match(entity, referencedName))
                          .findFirst();
              }
          }
          return Optional.empty();
      }