ProjectUserInsert() public static method

public static ProjectUserInsert ( ProjectUser projectUser ) : ProjectUser
projectUser ProjectUser
return ProjectUser
        internal static ProjectUser ProjectUserAdd(int projectId, int userId, Role role, bool ignoreAuthorization)
        {
            var projectUser = ProjectUser.NewProjectUser(projectId, userId);

            projectUser.RoleId = (int)role;

            if (ignoreAuthorization)
            {
                projectUser = ProjectUserRepository.ProjectUserInsert(projectUser);
            }
            else
            {
                projectUser = ProjectUserRepository.ProjectUserSave(projectUser);
            }

            return(projectUser);
        }
        public static ProjectUser ProjectUserSave(ProjectUser projectUser)
        {
            if (!projectUser.IsValid)
            {
                return(projectUser);
            }

            ProjectUserRepository.AuthorizeProjectUser(projectUser.ProjectId);

            ProjectUser result;

            if (projectUser.IsNew)
            {
                result = ProjectUserRepository.ProjectUserInsert(projectUser);
            }
            else
            {
                result = ProjectUserRepository.ProjectUserUpdate(projectUser);
            }

            return(result);
        }