Refactor schema and model code out of mongoose config file
Added rules to prevent duplicate records and handle login correctly