public user SaveUser(user userToSave)
        {
            using (MTIUserRolesEntityDataModel mtiUserRolesEntityDataModel = new MTIUserRolesEntityDataModel())
            {
                userToSave = _userAdministrationRepository.SaveUser(userToSave, mtiUserRolesEntityDataModel);
            }

            return userToSave;
        }
        public user SaveUser(user userToSave, MTIUserRolesEntityDataModel mtiUserRolesEntityDataModel)
        {
            user existingUser = null;

            try
            {
                if (userToSave.userId != Guid.Empty)
                {
                    existingUser = (from user in mtiUserRolesEntityDataModel.users
                                    where user.userId == userToSave.userId
                                    select user).SingleOrDefault();
                }

                if (existingUser == null)
                {
                    userToSave.createDate = DateTime.Now;
                    userToSave.createdBy = SessionData.Current.LoggedInUser.LoggedInUserId;
                    mtiUserRolesEntityDataModel.users.Add(userToSave);
                }
                else
                {
                    existingUser.email = userToSave.email;
                    existingUser.firstname = userToSave.firstname;
                    existingUser.lastname = userToSave.lastname;
                    existingUser.password = userToSave.password;
                    existingUser.createDate = DateTime.Now;
                    existingUser.createdBy = SessionData.Current.LoggedInUser.LoggedInUserId;
                }

                mtiUserRolesEntityDataModel.SaveChanges();
            }
            catch (DbEntityValidationException e)
            {
                foreach (var eve in e.EntityValidationErrors)
                {
                    Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                        eve.Entry.Entity.GetType().Name, eve.Entry.State);
                    foreach (var ve in eve.ValidationErrors)
                    {
                        Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"",
                            ve.PropertyName, ve.ErrorMessage);
                    }
                }
                throw;
            }

            return GetUserFromEmail(userToSave.email, mtiUserRolesEntityDataModel);
        }