Moved position calculation to db_model