public static void GenerateIDIfNeeded(this IIdentifiable ident) { if (ident.getID().Length == 0) { // Empty string, reassign ident.setID(System.Guid.NewGuid().ToString()); } }