Added database functionality for the SAG page