My implementation of active record