moved orm functions to services