fix database methods that could deadlock
fix database methods that could deadlock

[#117024821]

Signed-off-by: Maria Shaldibina <dc03896a0185453e5852a5e0f0fab6cbd2e026ff@pivotal.io>

zachgersh/atc,zachgersh/atc,zachgersh/atc,zachgersh/atc