Working functionalities with database