private DataSource getDataSourceById(long?dataSourceId) { if (!dataSourceId.HasValue) { // TODO: return errorResult throw new BasicException("No project specified.", "projectId is null."); } DataSource dataSource = _dataSourceService.GetSingleById(dataSourceId.Value, true, false); if (dataSource == null) { // TODO: return errorResult throw new BasicException("The specified data source could not be found. It might have been deleted by another user.", string.Format("Data Source with id {0} not found.", dataSourceId.Value)); } return(dataSource); }