public OperationResult<UserDataModel> AddUser(UserSaveDataModel user)
		{
			return OperationResult<UserDataModel>.Invoke(() =>
			{
				using (var dataBase = CreateConnection())
				{
					if (dataBase.Users.Any(x => x.Login == user.Login)) throw new ErrorCodeException(ErrorCode.UserSameLogin);

					dataBase.Users.Add(new User
					{
						Login = user.Login,
						FirstName = user.FirstName,
						LastName = user.LastName,
						IsManager = user.IsManager,
						Password = user.Password
					});

					dataBase.SaveChanges();

					var userData = dataBase.Users.FirstOrDefault(x => x.Login == user.Login);
					if (userData == null) throw new ErrorCodeException(ErrorCode.DataBaseTransactionFailed);

					return ConverterModel.UserDataModel(userData);
				}
			});
		}
		public OperationResult<UserDataModel> AddUser(UserSaveDataModel user)
		{
			return OperationResult<UserDataModel>.Invoke(() =>
			{
				if (Users.Any(x => x.Login == user.Login)) throw new ErrorCodeException(ErrorCode.UserSameLogin);

				Users.Add(new User
				{
					Id = Users.Max(x => x.Id) + 1,
					Login = user.Login,
					FirstName = user.FirstName,
					LastName = user.LastName,
					IsManager = user.IsManager,
					Password = user.Password
				});

				var userData = Users.FirstOrDefault(x => x.Login == user.Login);
				if (userData == null) throw new ErrorCodeException(ErrorCode.DataBaseTransactionFailed);

				return ConverterModel.UserDataModel(userData);
			});
		}
		public OperationResult EditUser(UserSaveDataModel user)
		{
			return OperationResult.Invoke(() =>
			{
				if (Users.Any(x => x.Login == user.Login && x.Id != user.UserId)) throw new ErrorCodeException(ErrorCode.UserSameLogin);

				var userData = Users.First(x => x.Id == user.UserId);

				userData.LastName = user.LastName;
				userData.FirstName = user.FirstName;
				userData.Login = user.Login;
				user.Password = user.Password;
			});
		}
		public OperationResult EditUser(UserSaveDataModel user)
		{
			return OperationResult.Invoke(() =>
			{
				using (var dataBase = CreateConnection())
				{
					if (dataBase.Users.Any(x => x.Login == user.Login && x.Id != user.UserId)) throw new ErrorCodeException(ErrorCode.UserSameLogin);

					var userData = dataBase.Users.Find(user.UserId);

					userData.LastName = user.LastName;
					userData.FirstName = user.FirstName;
					userData.Login = user.Login;
					user.Password = user.Password;

					dataBase.Users.Attach(userData);
					var entry = dataBase.Entry(userData);
					entry.State = EntityState.Modified;
					
					dataBase.SaveChanges();
				}
			});
		}