save unit functionality