add record logic