Moved logic from pg/Command to BaseCommand, introduced ToMayRelation (tbf...), improved handling for ToOneRelation (amd)