add support for declaring a factory that returns a record