Use showUnsavedMessage in lead template
Extract lead method in lead api controller