created factory and functions used in ShowControllerand EditController