standalone implementation of active records pattern for php