Made more reusable functions in db and added put to resource