moving some Record logic from server to handler