consolidate create update code