use Sample.transaction instead Application.transaction and lock when inserting new application