Refactored the database logic so that Forits works when Sitecore.Context.Database is null - uses the Item or Field to get the correct database reference now.