Refactor profile_set View code. Remove duplicate code