public bool CreateAccess(AccessInDTO access) { try { var accessExists = _accessRepository.FindAll().Any(x => x.Name.ToLower() == access.Name.ToLower()); if (accessExists) { return(false); } var newAccess = new Access(); newAccess.Name = access.Name; newAccess.Description = access.Description; newAccess.CreatedBy = null; newAccess.Category = access.Category != null ? access.Category : String.Empty; newAccess.CreatedOn = Localization.GetUTCDateNow(); newAccess.AccessId = Guid.NewGuid(); _accessRepository.Add(newAccess); } catch (Exception ex) { throw new Exception(ex.Message); } return(true); }