changed remove and loadRelations methods to work with external databases (T-6649, T-6662)