Prevent referencing the database multiple times