public BugTrackingResponse <BusinessObjects.Organization> Save(BusinessObjects.Organization org)
        {
            Logger.TraceMethodStart(ClassName, "Save");

            var response = new BugTrackingResponse <BusinessObjects.Organization>();

            using (var db = new EntityModel.BugTrackingEntities())
            {
                using (var transaction = db.Database.BeginTransaction())
                {
                    try
                    {
                        var validator = new OrganizationSpecification();
                        var result    = validator.Validate(org);
                        var failures  = result.Errors;

                        response.ValidationResult = result;

                        if (result.IsValid)
                        {
                            org.LastModified = DateTime.Now;
                            org.Active       = true;
                            var neworg = MapperAllLevels.Map <BusinessObjects.Organization, EntityModel.Organization>(org);
                            db.Organizations.Add(neworg);
                            db.SaveChanges();
                            transaction.Commit();
                        }

                        else
                        {
                            transaction.Rollback();
                            Logger.TraceErrorFormat("Error while Saving {0}", response.ValidationResult.Errors);
                        }

                        return(response);
                    }



                    catch (Exception ex)
                    {
                        Logger.TraceError("Exception: ", ex);
                        transaction.Rollback();
                        throw;
                    }

                    finally
                    {
                        Logger.TraceMethodEnd(ClassName, "Save");
                    }
                }
            }
        }
        public ActionResult CreateOrganization([Bind(Include = "Id,Name,Location,Email,TelephoneNumber, LastModified, Active")] BusinessObjects.Organization org)
        {
            var response = orgmanager.Save(org);

            if (!response.IsError)
            {
                return(RedirectToAction("/OrganizationList"));
            }
            else
            {
                foreach (var failer in response.ValidationResult.Errors)
                {
                    ModelState.AddModelError(failer.PropertyName, failer.ErrorMessage);
                }
                return(View());
            }
        }