/// <summary>
        /// Checks the rights for the deletion and deletes the dataset
        /// </summary>
        /// <param name="id">dataset id</param>
        /// <param name="userId">userid</param>
        public void Delete(int id, int userId)
        {
            Dataset ds = _datasetRepository.GetById(id);

            if (ds.UserId != userId)
            {
                throw new Exception("No permission to delete this dataset.");
            }
            if (ds != null)
            {
                _datasetRepository.Delete(ds);
                _datasetRepository.DataContext.Commit();
            }
        }