Add Database locking