public ReleasesManager()
 {
     if (Statics.db==null)
     {
         db = new ApplicationDbContext();
     }
 }
        public void Create(Project project,string  user)
        {
            try
            {
                if (usrmng == null)
                {
                    usrmng = new ProjectUserManager();
                }

                if (project != null && CommonTools.isEmpty(user) == false
                   && usrmng.UserExists(user) == true)
                {

                    ApplicationUser admin = usrmng.GetUser(user);
                    if (admin != null)
                    {

                        Wiki wk = new Wiki();
                        wk.Name = project.Name;
                        wk.WikiTitle = project.Name;
                        wk.Administrator = admin.Id;
                        wk.Moderators = new List<WikiMods>();
                        WikiMods wkm = new WikiMods();
                        wkm.Moderator = admin.Id;
                        wkm.Wiki = wk;
                        wk.Moderators.Add(wkm);
                        wkmngr.CreateWiki(wk,user);

                        //project.Admininstrator = admin;
                        //project.AdmininstratorId = admin.Id;
                        ApplicationUser owner = new ApplicationUser();

                        //owner.Claims = admin.Claims;
                        owner = admin.Clone();

                        project.WikiName = project.Name;
                       project.News = new List<ProjectNews>();
                        //List<FileReleases> filelst= new List<FileReleases>();
                        //project.Releases = filelst;
                        project.Members = new List<ProjectMember>();
                        if (db == null)
                        {
                            db = new ApplicationDbContext();
                        }
                        //ProjectUser projusr = new ProjectUser();
                        //   project.Admininstrator = owner;

                       project.Admininstrator = admin.Id;
                       //   db.Configuration.ValidateOnSaveEnabled = false;
                       // db.Configuration.LazyLoadingEnabled = true;
                        //Statics.usersprojmngr.AddNewProjectToUser(admin, project);
                        db.Projects.Add(project);

                        db.SaveChanges();
                        string plugrelpath= plugmanger.GetPluginFilesRelativeDir("Projects");
                        string path = Path.Combine(plugrelpath, project.Name);
                        FileManager.CreateDirectory(path);

                    }
                }

            }
            catch (Exception ex)
            {
                CommonTools.ErrorReporting(ex);

            }
        }